Tuesday, May 27, 2014

jQuery Syntax For Event Methods

1) click() : The function is executed when the user clicks on the HTML element.
 $("p").click(function(){
  $(this).hide();
});

2)dblclick() : The function is executed when the user double-clicks on the HTML element.
 $("p").dblclick(function(){
  $(this).hide();
});

3)mouseenter() : The function is executed when the mouse pointer enters the HTML element.
$("#p1").mouseenter(function(){
  alert("You entered p1!");
});

4)mouseleave() : The function is executed when the mouse pointer leaves the HTML element
$("#p1").mouseleave(function(){
  alert("Bye! You now leave p1!");
});

5)mousedown() : The function is executed, when the left mouse button is pressed down, while the mouse is over the HTML element
$("#p1").mousedown(function(){
  alert("Mouse down over p1!");
});

6)mouseup() : The function is executed, when the left mouse button is released, while the mouse is over the HTML element

$("#p1").mouseup(function(){
  alert("Mouse up over p1!");
});

7) hover() : The first function is executed when the mouse enters the HTML element, and the second function is executed when the mouse leaves the HTML element

$("#p1").hover(function(){
  alert("You entered p1!");
  },
  function(){
  alert("Bye! You now leave p1!");
});

8) focus() : The function is executed when the form field gets focus
$("input").focus(function(){
  $(this).css("background-color","#cccccc");
});
$('#tblCadastro input').focus();

9)blur() : The function is executed when the form field loses focus
$("input").blur(function(){
  $(this).css("background-color","#ffffff");
}); 
 


No comments:

Post a Comment