Do you add additional parameters to XHTML tags to make Javascript selectors more readable?
Subj.
For example...
<a href="#" act="check_all" with="category_checkbox">Check all</a>
<p>
<input type="ch开发者_如何学编程eckbox" name="category[1]" tag="category_checkbox" /> Category 1
<input type="checkbox" name="category[2]" tag="category_checkbox" /> Category 2
</p>
PS: What advantages and disadvantages of this method? Please explain why. By the way, if you are using only id,classes for selecting items. please describe what names you are using for it?
Adding additional attributes to the markup feels dirty some how, so I've settled for classes and id prefixes.
Classes like: "click-capture" for setting up hijaxing in a nesting friendly way a la .live()
and $(this).closest(".click-capture").laod(...)
Parenting in a 2 layer tree via #afd98f for parent and .afd98f for children.
精彩评论