概要
閲覧数:2952
投稿日:2017-06-04
更新日:2017-06-04
id名を取得
・イベントオブジェクト.target.id
クリックした要素のクラス名を取得
・イベントオブジェクト.target.className
コード
document.body.addEventListener( 'click', function(event) { console.log(event.target.id); //id console.log(event.target.className); //クラス });