Sunday, December 25, 2011

Hide an element when you click on the button


Example 10: Hide the paragraph when you click on the button

<html>
<head>
<title> Hide function</title>
<script type="text/javascript" src="../jquery.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("button").click(function(){
$("p").hide();
});
});
</script>
</head>

<body>
<center>
<h2>Hide the paragraph when you click on the button.</h2>
<p>[I am a paragraph. when you click on the button, I will hide.] </p>
<button>Click me</button>
</center>
</body>
</html>

No comments:

Post a Comment