Can we modify the attribute’s value of the HTML tag dynamically?
You can use setAttribute()
function.
For eg:
<button>Hello World</button>
var b = document.querySelector("button"); b.setAttribute("name", "myButton");
Can we modify the attribute’s value of the HTML tag dynamically?
You can use setAttribute()
function.
For eg:
<button>Hello World</button>
var b = document.querySelector("button"); b.setAttribute("name", "myButton");