Posts by Carlos • 21 points
1 post
-
2
votes2
answers2906
viewsQ: How to add a class to an HTML element via Javascript. In my case, I need to add a class to the H1 element below
I need to add a class to the H1 element var div = document.createElement("div"); var h1 = document.createElement("h1"); var p = document.createElement("p"); h1.textContent = "Me Ajuda";…