Answers for "getelementbyid set attribute"

14

set attribute javascript

Element.setAttribute(name, value);
Posted by: Guest on March-02-2020
0

js setattribute

const link = document.querySelector('a');

console.log(link.getAttribute('href'));
link.setAttribute('href', 'https://yandex.ru');
link.innerText = 'The Next Link';

const mssg = document.querySelector('p');

console.log(mssg.getAttribute('class'));

mssg.setAttribute('class', 'success');
mssg.setAttribute('style', 'color: green;');
Posted by: Guest on July-19-2020

Code answers related to "getelementbyid set attribute"

Code answers related to "Javascript"

Browse Popular Code Answers by Language