js 获取自定义属性值
html:
<p tid="1" onClick="change()">111</p> <p tid="2" onClick="change()">111</p> <p tid="3" onClick="change()">111</p>
js:
function change(ev) { var ev = ev || window.event, target = ev.target || ev.srcElement, tid = target.getAttribute('tid'); console.log('tid',tid) }