Answers for "how to hide text and make it appear on click in html"

1

html button that hide and show

<button onclick="toggleText()">button</button>
<p id="Myid">Text</p>
<script>
function toggleText(){
  var x = document.getElementById("Myid");
  if (x.style.display === "none") {
    x.style.display = "block";
  } else {
    x.style.display = "none";
  }
}
</script>
Posted by: Guest on October-17-2020
0

html click hide textbox

//hide
document.getElementById("idOfTextField").style.display = 'none';

//visible
document.getElementById("idOfTextField").style.display = '';
Posted by: Guest on November-25-2020

Code answers related to "how to hide text and make it appear on click in html"

Browse Popular Code Answers by Language