0

ここで、ラベル ID を見つけて ID を選択したいのと同じ方法で、テキスト ID を見つけることができます

$('input[type="text"]').focus(function () {
   var id = $(this).attr('id');
   $('#' + id).draggable({ cancel: true });
});
4

1 に答える 1

0

フォーカス イベントはラベル用ではないため、マウス エンターをラベル フォーカス イベントに使用できます。

ライブデモ

$('label').mouseenter(function () {
      var id = $(this).attr('id');
      $('#' + id).draggable({ cancel: true });
});

選択用

$('select').focus(function () {
      var id = $(this).attr('id');
      $('#' + id).draggable({ cancel: true });
});
于 2012-10-18T10:03:01.037 に答える