$('.xys').live('blur', function() {
});
input textfield私はwithを持っているとしましょうclass xyz。この関数は、要素がフォーカスを失ったことを正常に通知します。しかし、どの要素にフォーカスを失ったのかを知るにはどうすればよいでしょうか?
別の場所をクリックしたり、別のテキスト フィールドに移動するために押したりすると、さらに説明すると、どこtabに行ったのかを知るにはどうすればよいでしょうか?
targetオブジェクトのプロパティを使用できeventます:
$(document).on('blur', '.xys', function(event) {
alert('blur: ' + event.target.id)
// or alert(event.target.localName)
});
$(document).on('focus', '.xys', function(event) {
alert('focus: ' + event.target.id)
// or alert(event.target.tagName)
});
liveメソッドは非推奨であることに注意してくださいon。メソッドを使用できます。