{ Wed, 08. Oct 2014 }

The State of using IDs and Classes for your JavaScript in HTML5

Don’t. Do. It.

We’ve been doing it for what seems like ages. We’re hooking our JavaScript onto custom classes and IDs in our HTML. Classes and IDs solely created for this one purposes. Even the guys over at jQuery (which we all use - or at least have at one point) are doing it. And it’s starting to drive me insane.

We have enough custom classes as it is, especially now with Bootstrap and Co., which is bad enough1 in and of itself.

1
<div class="col-xs-12 col-sm-3 col-lg-1 sidebar hide-on-hover">...</div>

I mean - seriously? I can’t see my content between all of that markup. And where are the classes I actually care about?