How to change HTML button element text using JavaScript

1 Answer

0 votes
<input type="button" value="text"  id="btnid" />
const btn = document.getElementById("btnid");

btn.addEventListener("click", ()=>{
		btn.value = "new text"
})
    
    
    
    
/*
run:
    


*/

 



answered Jun 29, 2021 by avibootz
...