Do you comment your DOM manipulation?

I’m not talking about commenting your code, although you should be doing that anyway. JavaScript has the ability to create HTML comments: var comment = document.createComment(‘the comment itself’); document.getElementById(‘foo’).appendChild(comment); You can even do it in jQuery: $(‘<!–the comment itself–>’).appendTo(‘#foo’); Now, I know what you’re thinking: why, why would anyone want to create something that doesn’t […]

I hate jQuery fan-boys

Have you ever noticed these people? Ask them the most simple JavaScript question and they’ll respond with the answer in jQuery, even if that answer’s a lot more complicated. I was on a forum and someone asked a question about shortening getElementsByTagName. He wanted to be able to do this: var myInputs = getID(‘myid’).getTag(‘input’); The […]