Answers for "apply html attribute to element using javascript"

0

giving an html element own attribute using js

element.hasAttribute('foo');
element.getAttribute('foo');
element.setAttribute('foo', value);
element.removeAttribute('foo');
Posted by: Guest on December-08-2021
2

create an attribute for html with javascript

document.getElementsByTagName("H1")[0].setAttribute("class", "democlass");
Posted by: Guest on April-17-2020

Code answers related to "apply html attribute to element using javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language