skip to Main Content

Html – Console log not showing the attribute

I am using below HTML for my code. <body> <div id="myId" class="oldClass"> This is the original content of the element with ID "myId". </div> </body> I am perform DOM Manipulation using below JavaScript Code: const myElement = document.getElementById('myId'); myElement.setAttribute('data-example', 'value');…

VIEW QUESTION
Back To Top
Search