Below mentioned is the way to get the element by Class Name
var Tag = replaceContentInContainer('className');
function replaceContentInContainer(matchClass) {
var elems = document.getElementsByTagName('*'), i;
for (i in elems) {
if ((" " + elems[i].className + " ").indexOf(" " + matchClass + " ") > -1) {
}
}
}
I have onclick and style attribute with this Tag.
My query is, How can I remove/add the onclick/style attribute in this tag using JavaScript ?
By using JQuery you could use class selectors and then remove associated attributes by using the removeattr function:
To add and remove some class: