Latest news
Home » jQuery » jQuery div Hide and show on click

jQuery div Hide and show on click

jQuery div Hide and show

<style>

#smarttipsdiv {
width: 90%;
margin:auto;
height:200px;
background-color: #008000;
}
a  { font-size: 100%;  font-weight: normal;  }

</style>

<script>
$(document).ready(function(){

$(‘#toggle’).click(function(e){
e.preventDefault();

var isvisible = $(‘#smarttipsdiv’).is(‘:visible’);

if(isvisible) {
$(‘#smarttipsdiv’).slideUp();
}
else {
$(‘#smarttipsdiv’).slideDown();
}

});

});

</script>

<a id=’toggle’ href=”#”>Heading</a>
<div id=”smarttipsdiv”></div>

Leave a Reply

x

Check Also

How to Check Expired Sessions using jQuery Ajax and PHP

We can achieve using the php and ajax.The following ajax call execute in every 10 ...