JQuery Basics

From Logic Wiki
Jump to: navigation, search


Examples

Adding Event

$(document).ready(function(){
  $("p").click(function(){
    $(this).hide();
  });
});
$("p").hide()

Demonstrates the jQuery hide() method, hiding all < p > elements.


$("#test").hide()

Demonstrates the jQuery hide() method, hiding the element with id="test".

$(".test").hide()

Demonstrates the jQuery hide() method, hiding all elements with class="test".

$(this).hide()

Demonstrates the jQuery hide() method, hiding the current HTML element.

jQuery click()

Demonstrates the jQuery click() event.

jQuery dblclick()

Demonstrates the jQuery dblclick() event.

jQuery mouseenter()

Demonstrates the jQuery mouseenter() event.

jQuery mouseleave()

Demonstrates the jQuery mouseleave() event.

jQuery mousedown()

Demonstrates the jQuery mousedown() event.

jQuery mouseup()

Demonstrates the jQuery mouseup() event.

jQuery hover()

Demonstrates the jQuery hover() event.

jQuery focus() and blur()

Demonstrates the jQuery focus() and blur() events.