custom data attributes alternative?

无人久伴 提交于 2020-01-15 07:58:06

问题


The following code is in a while loop, with values from the database. I am storing these values in custom data attributes for jQuery.

<div class='pending-information' data-id='$id' data-pid='$position' data-sid='$sid' data-image='$image' data-counter='$counter' data-start='$start'></div>

What is the professional approach? This method won't be valid in XHTML1. So whats the common method for storing attributes/values for jQuery?


回答1:


What is the professional approach?

Exactly what you are doing - data-* attributes are common way to do this.

This method won't be valid in XHTML1

So what? XHTML is not going to be extended into a new version - it is HTML 5 from now on and data-* attributes are the way to go.



来源:https://stackoverflow.com/questions/10121469/custom-data-attributes-alternative

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!