Reputation: 6940
I'm trying to make it really obvious in the DOM that javascript code depends on the structure. Is the following a good idea?
HTML: <a class='submenu' data-submenu="true" .... </a> JS: var mySubnav = $("[data-submenu]");
Makes it really clear that javascript is operating on the html. But I haven't seen this used by other people.
Upvotes: 0
Views: 131
Reputation: 76
I'm not sure why you can't just use classes for this case? If your links have a subnav class that's far more compatible and easy to parse, plus stylable, than a data-submenu attribute.
Upvotes: 1