Answers for "Javascript getelementbyid hide element"

1

Javascript getelementbyid hide element

// Toggle between hiding and displaying an element
<div id="myDIV" onclick="javascript:myFunction()">myDiv</div>
<script>
function myFunction() {
  var x = document.getElementById('myDIV');
  if (x.style.display === 'none') {
    x.style.display = 'block';
  } else {
    x.style.display = 'none';
  }
}
</script>
Posted by: Guest on October-29-2021

Code answers related to "Javascript getelementbyid hide element"

Browse Popular Code Answers by Language