Working Example:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | <html> <head> <title>jQuery show</title> <script type="text/javascript" src="http://code.jquery.com/jquery-1.4.2.js"></script> <script type="text/javascript"> function Show_Div(Div_id) { if (false == $(Div_id).is(':visible')) { $(Div_id).show(250); } else { $(Div_id).hide(250); } } </script> </head> <body> <br /> <input type="button" value="Click me to show or hidden div" onclick="Show_Div(Div_1)" /> <br /> <br /> <div id="Div_1" style="display: none; background-color: #ffffdd; width: 300px;"> I am div <br /> Now you can see me. </div> </body> </html> |
Source: http://www.learnfast.ninja/posts/53c4e6e004dc4884098cb647