How to use Hide Method in JQuery
This article describe about jQuary Hide Button and Paragraph Method.
Hide button in jQuery
$(this).hide() method
hide() method is use to hide a button.
$(this).hide() is use hiding current HTML element above this page.
Example
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$("button").click(function () {
$(this).hide();
});
});
</script>
</head>
<body>
<button>Click here</button>
</body>
</html>
|
Output
click this button, then hide the button above this page .
Hide paragraph in jQuery
$("p").hide() method
hide() method is hide a paragraph.
$("p").hide() method hiding all<p> elements in jQuery.
Example
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$("button").click(function () {
$("p").hide();
});
});
</script>
</head>
<body>
<h2>This is a jQuery</h2>
<p>This is a text.</p>
<button>Click here</button>
</body>
</html>
|
Output
After click button
You may also want to read these related articles here
Ask Your Question
Got a programming related question? You may want to post your question here
Programming Answers here