+ 8
Can we modify the attribute's value of the HTML tag dynamically?
5 Réponses
+ 7
Yes of course You can modify it by using JavaScript
Here is the syntax
document.getElementByTagName("tag name").setAttribute("attribute name", "value");
+ 5
Yes, with JavaScript: document.getElementsByTagName("H1")[0].setAttribute("class", "democlass");
+ 2
Hi, can you elaborate on your idea further in detail? I suppose there will be more people interested with detailed explanation. Write some more in the Description section so your idea could be more comprehensible.
Good luck with solution 👍
+ 1
Yes! Whith JavaScript language.
+ 1
Also you can do it with JQuery:
$("#myCheckBox").attr("checked", true);
or
$("#myCheckBox").prop("checked", true);
or
$("#myDiv").attr("title", "this is my hint...");