I\'ve been fighting with this simple piece of code forever. I\'m trying to use a to call a simple JavaScript function to hide a
Let's do something in jQuery:
<button type="button" id="btn">OK</button>
<div id="myDiv">Div's contents here</div>
Now, you need just use the code below to do what you want:
<script type="javascript">
$(document).ready(function(e) {
$("#btn").click(function () {
$("#myDiv").hide();
});
});
</script>
Notice: you can have some properties for hide() function: Fast and slow. This will affect on the speed of hiding action.
$("#myDiv").hide("slow");
I hope this can help you.
Try changing the close
function name to something else like closeit
because it may be confusing it with the window.close()
function.
Try document.getElementById('wrong').setAttribute('style', 'display:none');