2013年4月15日 星期一

jQuery .bind() and .unbind(event)

.bind(eventType, handler(eventObject)) attaches a handler to an event for the selected element(s)

image

.click() is the same as .bind(‘click’)

 

.unbind(event) is used to remove a handler previously bound to an element

image

specific events can also be targeted using unbind()

image

 

bind() allows multiple events to be bound to one or more elements with a separated space in between

image

 

Demo Example:

original source code

image

by using .bind() function

image

 

unbind above mouseup event if button click

image

沒有留言:

張貼留言