Is it possible to use the onClick on a button to make the contents of a <div> invisible ?
Is it possible to use the onClick on a button to make the contents of a <div> invisible ?
Code:<html> <head> <script type="text/javascript"> function hideMe() { var id = document.getElementById('div1'); id.style.display = "none"; } </script> </head> <body> <input type="button" value="Hide Div" onclick="hideMe()"> <div id="div1"> Dynamic Drive Forums </div> </body> </html>
Last edited by keyboard; 04-12-2012 at 10:30 PM. Reason: Added in dd forums between div
Yes, you can hide the div or erase the innerHTML
Hide dive:
Erase html content from div:Code:onClick="document.getElementById('divId').style.display="none";
Code:onClick="document.getElementById('divId').innerHTML="";
Bookmarks