View Full Version : function to make set a <div> invisible ?
daxtrajero
04-12-2012, 05:44 PM
Is it possible to use the onClick on a button to make the contents of a <div> invisible ?
keyboard
04-12-2012, 09:07 PM
<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>
crobinson42
04-13-2012, 12:50 AM
Yes, you can hide the div or erase the innerHTML
Hide dive:
onClick="document.getElementById('divId').style.display="none";
Erase html content from div:
onClick="document.getElementById('divId').innerHTML="";
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.