Difference between jQuery click, bind, live, delegate & trigger functions( with example)
Posted
by I Like PHP
on Stack Overflow
See other posts from Stack Overflow
or by I Like PHP
Published on 2010-06-02T04:03:39Z
Indexed on
2010/06/02
11:24 UTC
Read the original article
Hit count: 139
JavaScript
|jQuery
Hello All,
I know there are a lot of questions similar to this, but I want to know clear difference between all of these jQuery functions together on this page with an example, so that it will be very helpful for me to understand the mechanism of all of these functions. I have also read the reference on jQuery main site, but there is no comparison between these:
$().click(fn)
$().bind('click',fn)
$().live('click',fn)
$().delegate('td','click',fn)
$().trigger('click') // UPDATED
Please do not refer any link if there is a part of question belong to that.
Please describe how all four function exactly works in different manner, and which should be preferred in which situation.
Note: If there are any other function with same functionality/mechanism , then please share.
Thanks a lot.
Update
i have also seen $(trigger)
function? is this works similar to above four function ?
© Stack Overflow or respective owner