Answers for "get the set attribute value of an element in js dom"

2

set attribute in javascript

//Fetch id from html
var a = document.getElementById("id");

//variable.setAttribute("Attributes","Properties:Values")
a.setAttribute("style", "visibility:hidden;");
Posted by: Guest on May-22-2021
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 "get the set attribute value of an element in js dom"

Code answers related to "Javascript"

Browse Popular Code Answers by Language