jQuery Events Part - I : Document loading Events and Keyboard Events ~ TechieIT

Wednesday, August 24, 2011

jQuery Events Part - I : Document loading Events and Keyboard Events

jQuery basically have following type of events:

                    Example:
                    $(document).ready(function() {  
                    // Handler for .ready() called.                      
                    });
                    Triggers event when page is fully loaded with all control:
                    $(window).load(function () {
                      // Add code here                              
                    });
                         
                    You may call if any element on page is loaded
                    <img src="something.png" id="imageDemo" />
                    $("#imageDemo").load()(function() {
                      // Add code here.
                    });
                    Example:
                    $(window).unload(function() {
                       alert('I am unloading.');
                    });

                   so for textbox you can write it like:
                      <input id="keyDownDemo" type="text" value="Hello" />
                     $('#keyDownDemo).keydown(function() { 
                      alert(Hello jQuery KeyDown Happened.');
                     });
                   so for textbox you can write it like:
                      <input id="keyUpDemo" type="text" value="Hello" />
                     $('#keyUpDemo).keyup(function() { 
                      alert(Hello jQuery KeyUp happened.');
                     });
                   so for textbox you can write it like:
                      <input id="keyPressDemo" type="text" value="Hello" />
                     $('#keyPressDemo).keypress(function() { 
                      alert(Hello jQuery KeyPress happened.');
                     });

                 

0 comments :

Post a Comment