Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

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';
Source by developer.mozilla.org #
 
PREVIOUS NEXT
Tagged: #GET #SET #attribute #element
ADD COMMENT
Topic
Name
1+5 =