Where do you hang your semantic information, html?

Posted by bobobobo on Stack Overflow See other posts from Stack Overflow or by bobobobo
Published on 2010-05-21T22:28:38Z Indexed on 2010/05/21 22:30 UTC
Read the original article Hit count: 167

Filed under:
|
|

Well, I keep putting semantic information about what an element means for the page logically in the class attribute

<li class="phone-number">555-5555</li>

It seems to work for this dual purpose of hanging semantic information and a pointer to how to style it.

I'm not sure if this is the best idea, I'm trying to see if others have other ways of doing it.

I also started to use a hidden input:

<li>555-5555 <input class="semantics" type="hidden" value="phone-number" /></li>

inside an element, so with jQuery, I can retrieve additional information about the element using

li.find( '.semantics' ).val()

To get an element's semantics from JavaScript

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about html