Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
<div id="job" data-job-id="3054>jobs status</div>
如何获取上述节点中数据属性值的值。
只需使用 javascript .getAttribute() 方法。
var val = document.getElementById('job').getAttribute('data-job-id');
作为更好的解决方案
console.log(e.target.dataset.job-id)