Would somebody be able to tell me what i am doing wrong in this simple hide element script using
JQuery? When i click the button its meant to hide the text in the disclaimer tag. Thanks.
index.html:
<!DOCTYPE HTML">
<html>
<head>
<title></title>
<meta name="" content="">
<script src="script.js" type="text/javascript"></script>
<script type='text/javascript' src='jquery.js'></script>
</head>
<body>
<input type="button" id="hideButton" value="hide"/>
<div id="disclaimer">
<p>This is a disclaimer</p>
</div>
</body>
</html>
script.js:
$('#hideButton').click(function() {
$('#disclaimer').hide();
});
you should enclose it in document ready
also reference
jquery.jsbeforescript.js