skip to Main Content

how to convert from string to integer an html element content on javascript side

let counter = parseInt(document.getElementById("#integer").innerHTML) let incbutton = document.querySelector("#increase") incbutton.addEventListener("click", increase) function increase() { counter += 1; } <h1 id="integer">100</h1> <button id="increase">Increase</button> when ı try to convert to integer content of h1 tag increase button is not working. ı think because…

VIEW QUESTION
Back To Top
Search