how to change the html content of an element on toggle click button code example

Example 1: jquery toggle text on click

$(function(){
   $(".pushme").click(function () {
      $(this).text(function(i, text){
          return text === "PUSH ME" ? "DON'T PUSH ME" : "PUSH ME";
      })
   });
})

Example 2: toggle element javascript

document.querySelector("#test").hidden = true;
document.querySelector("#test").hidden = false;

Example 3: how to toggle in text add

$(".email-slide").click(function(){
    $("#panel").slideToggle("slow");
    $(this)
    .text("Close")
    .toggleClass("active");
});

Tags:

Misc Example