以下のようにボタンに「data-test」という要素の属性があり、クリックイベント時にjs側で属性を取得するサンプルです。
html側
<input type="button" onClick="registButton(this)" data-test="aaaaa">
javascript側
function registButton(obj) { var val = obj.getAttribute("data-test"); alert(val); }
以下のようにボタンに「data-test」という要素の属性があり、クリックイベント時にjs側で属性を取得するサンプルです。
html側
<input type="button" onClick="registButton(this)" data-test="aaaaa">
javascript側
function registButton(obj) { var val = obj.getAttribute("data-test"); alert(val); }