Currently I have a code that looks like this:
$('a.guide-item[href="/"]').remove();
$('*[href="/"]').attr('href','/feed/subscriptions/u');
I need to make the file size smaller, but I don’t know how to replicate the code in “vanilla” javascript. Please help!
Without supporting IE6/7, it’s very simple.
If you need to support IE6/7, it’s still very simple, but it would be helpful to have a method that selects elements by class, or at least that tests for a class.
Not hard to find implementations of these on the web.
Here’s a quick implementation that will support older IE.
It assumes that the
.classNamewon’t have other classes where"guide-item"would be matched as a sub-pattern.