我有这个工作,但我想知道这是正常的做法。
<button vacation="2" type="button" class="delete" id="vc-2"><i class="icon-static"></i></button>
我需要自定义属性。我制作了名为假期的自定义 html 属性。我通过事件访问它,如下所示:
var vacation = parseInt(e.currentTarget.attributes[0].value); //Zero, since this is the first attribute.
这行得通,但我很感兴趣这是最佳实践吗?如果可能,我想避免使用 HTML5 数据属性。