AspBucket offers ASP.NET, C#, VB, Jquery, CSS, Ajax, SQL tutorials. It is the best place for programmers to learn

Monday, 23 November 2015

Mostly used events in Jquery

If you are working with Jquery. You should aware about some basic Jquery events always. Here I am giving some important Jquery events.

Events

(1-) $(document).ready() event
This events executes when document or web page is fully loaded. 
$(document).ready(function(){
  //Write some java Script code here
});
Here selector can be any button, div, span etc

(2-) click() event
This event is executes when user clicks on associated HTML elements.
$("selector").click(function(){
    //Write some java Script code here
});
Here selector can be any button, div, span etc

(3-) change() event
This event is executes when control value change .
$("selector").change(function(){
    //Write some java Script code here
});
Here selector can be any drop down,Text box etc

(4-) dblclick() event
This event is executes when double click on HTML elements .

$("selector").dblclick(function(){
    //Write some java Script code here
});
(5-) on() event
on() method used when one or more event handlers for the selected elements.

$("selector").on({
    mouseenter: function(){
        $(this).css("background-color", "blue");
    }, 
    mouseleave: function(){
        $(this).css("background-color", "red");
    }, 
    click: function(){
        $(this).css("background-color", "yellow");
    } 
});
Here selector can be any div ,p or span etc.

0 comments :

Post a Comment

  • Popular Posts
  • Comments