Monday, 10 June 2013

jQuery show() and hide() Function | PHP Code for Beginners

In this tutorial of php code for beginners we will show you how to use jquery show() and hide() functions.
jQuery show() and hide() are the most common used functions. They are used to show or hide perticular element in the page.

show() – Display the matched elements.
hide() – Hide the matched elements.

<html>
<head>
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<style type="text/css">
div{
padding:8px;
margin:10px;
border:1px solid blue;
width:450px;
height:50px;
background-color:blue;
color:white;
}
</style>
</head>
<body>
<h1>jQuery show() and hide() example</h1>
<div>This is jquery show() and hide() example</div>
<button id=show_box>show </button>
<button id=hide_box>hide</button>
<script type="text/javascript">
 $("#show_box").click(function () {
   $("div").show('fast');
});
$("#hide_box").click(function () {
   $("div").hide('slow');
});
$("#reset").click(function(){
location.reload();
});
</script>
</body>
</html>
Hope this php tutorial is useful for you. Keep following PHP Tutorials for Beginners for more help.

No comments:

Post a Comment