Sunday, 20 July 2014

Document Ready Event Example

 <html>  
      <head>  
           <title></title>  
           <script type="text/javascript" src="js/jquery.js"></script>  
           <script type="text/javascript">  
              $(document).ready(function(){  
                   $('#message').fadeIn('show');  
                 });  
           </script>  
      </head>  
      <body>  
         <div id="message" style="display:none;">Welcome to my website</div>  
      </body>  
 </html> 

Click here to see Demo Demo1

Saturday, 19 July 2014

How to hide/show a Paragraph by using Jquery

 <html>  
 <head>  
 <script type="text/javascript">  
  function hideParagraph()  
  {  
        $('#message').toggle('fast');   
        var value = $('#toggle_message').attr('value');  
        if(value=='Hide')  
             $('#toggle_message').attr('value','Show');  
        else if (value=='Show')  
             $('#toggle_message').attr('value','Hide');  
  }     
 </script>  
 </head>  
 <body>  
    <input type="button" id="toggle_message" onclick="hideParagraph();" value="Hide"/>  
    <p id="message">This is my paragraph</p>  
 </body>  
 </html>  
Click here to see Demo