Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR HTML

change the text value for a HTML

const btn = document.getElementById("btn");

btn.addEventListener("click", ()=>{

    if(btn.innerText === "Red"){
        btn.innerText = "Blue";
    }else{
        btn.innerText= "Red";
    }
});
Source by reactgo.com #
 
PREVIOUS NEXT
Tagged: #change #text #HTML #element
ADD COMMENT
Topic
Name
2+6 =