ユーザーが入力のクリックに集中するたびに、メソッドをトリガーしたいと考えています。次のコードがあります。
jQuery(document).on('focus click', function(e){
console.log("focused on " + $(e.target).attr('id'));
});
しかし、私が要素に焦点を当てるときはいつでもfocused on undefined
. このコードの何が問題になっていますか?
ユーザーが入力のクリックに集中するたびに、メソッドをトリガーしたいと考えています。次のコードがあります。
jQuery(document).on('focus click', function(e){
console.log("focused on " + $(e.target).attr('id'));
});
しかし、私が要素に焦点を当てるときはいつでもfocused on undefined
. このコードの何が問題になっていますか?