Answers for "modify attribute getattr"

21

javascript change attribute

var element = document.getElementById("elemId");
element.setAttribute("attributeName", "value");
Posted by: Guest on June-03-2020
0

GET and SET the attribute of an element

const link = document.querySelector('a');
console.log(link.getAttribute('href'));
link.setAttribute('href', 'https://www.yahoo.com');
link.innerText='Yahoo';
Posted by: Guest on December-11-2021

Code answers related to "modify attribute getattr"

Code answers related to "Javascript"

Browse Popular Code Answers by Language