イベントハンドラの中で使用するthisとeventオブジェクトの違いがわかりません。
以下のコードでeventオブジェクトとthisを出力したところ同じものが出力されました。
thisとeventの違いを教えてください。
javascript
1$(function() { 2 $("form").on("submit", function(e) { 3 console.log("送信ボタンが押されました"); 4 console.log(this); 5 console.log("===================="); 6 console.log(e.target); 7 e.preventDefault(); 8 }); 9});
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。