문제

I already saw some tools which stores some state or data inside element's attribute:

<div clicks="2" id="myDiv" class="some-class">

but it's invalid in some doctypes.

At all. Is this a good solution for stateful elements? If not, some advice will be appreciated.

Thanks in advance.

도움이 되었습니까?

해결책

Under HTML5 you have the option to use, valid, data-* attributes, such as, in this case data-clicks to store user-defined data.

References:

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top