jQuery events

jQuery event

bind() method
The bind() method adds one or more event handlers to the selected element and specifies a function to run when the event occurs.

Syntax
$(selector).bind(event,data,function)
event Required. Specifies one or more events to add to the element. Multiple events are separated by spaces. Must be a valid event.
data is optional. Specifies additional data to pass to the function.
function Required. Specifies a function to run when the event occurs.
$(selector).bind({event:function, event:function, ...})//(Bind multiple event handlers)

Example:
When the mouse is clicked, hide or show the p element:
$("button") .bind("click",function(){
  $("p").slideToggle();
}); The



blur() method
fires the blur event when the element loses focus

Trigger blur event
$(selector).blur()

will function Binding to the blur event
$(selector).blur(function)



change() method
The change event occurs when the value of an element changes.
This event applies only to text fields, and textarea and select elements.

Trigger the change event
$(selector).change()

Bind the function to the change event
$(selector).change(function)



click() method
When the mouse pointer rests over an element, and then presses and releases the left mouse button, A click occurs.

Trigger the click event
$(selector).click()

Bind the function to the click event
$(selector).click(function)



Other method reference: http://www.w3school.com.cn/jquery/jquery_ref_events.asp



Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326996345&siteId=291194637