Comments on: Simple use of Event Delegation http://jqueryfordesigners.com/simple-use-of-event-delegation/ Tutorials and screencasts Thu, 22 Sep 2011 12:58:42 +0000 hourly 1 http://wordpress.org/?v=3.3.1 By: MathieuL http://jqueryfordesigners.com/simple-use-of-event-delegation/comment-page-1/#comment-9232 MathieuL Thu, 22 Sep 2011 12:58:42 +0000 http://jqueryfordesigners.com/?p=343#comment-9232 <p>What's the difference between .delegate() and .live()?</p> What’s the difference between .delegate() and .live()?

]]>
By: Russell http://jqueryfordesigners.com/simple-use-of-event-delegation/comment-page-1/#comment-9219 Russell Thu, 25 Aug 2011 11:44:31 +0000 http://jqueryfordesigners.com/?p=343#comment-9219 <p>On a separate note.... it would be nice to know which tags are available to use here in the comments. Thanks again for the vid.</p> On a separate note…. it would be nice to know which tags are available to use here in the comments. Thanks again for the vid.

]]>
By: Russell http://jqueryfordesigners.com/simple-use-of-event-delegation/comment-page-1/#comment-9218 Russell Thu, 25 Aug 2011 11:42:26 +0000 http://jqueryfordesigners.com/?p=343#comment-9218 <p>Thanks for this video, I had previously been using .live but will switch to .delegate having seen this. Reading the other comments it looks as if I was not alone in using .live. I think this is probably because .live was introduced in 1.3 and .delegate was introduced in 1.4.</p> Thanks for this video, I had previously been using .live but will switch to .delegate having seen this. Reading the other comments it looks as if I was not alone in using .live. I think this is probably because .live was introduced in 1.3 and .delegate was introduced in 1.4.

]]>
By: Matt http://jqueryfordesigners.com/simple-use-of-event-delegation/comment-page-1/#comment-9190 Matt Fri, 01 Jul 2011 16:07:00 +0000 http://jqueryfordesigners.com/?p=343#comment-9190 <p>Thanks so much for these great screencasts! Do you know if this will show up in the iTunes feed in the future? The latest one there is the previous screencast (Populate Select Boxes).</p> Thanks so much for these great screencasts! Do you know if this will show up in the iTunes feed in the future? The latest one there is the previous screencast (Populate Select Boxes).

]]>
By: Yosy http://jqueryfordesigners.com/simple-use-of-event-delegation/comment-page-1/#comment-9179 Yosy Thu, 23 Jun 2011 00:00:38 +0000 http://jqueryfordesigners.com/?p=343#comment-9179 <p>Hi Remy, you mentioned that event delegation can helps when the DOM is changing, I agree but in addition event delegation for example can help when you have a big table with a lot of rows and you want to give the user option to change the content in the cell. For this example,event delegation would be great instead of RxC(rows multiplied by columns) events (click event for each cell).</p> <p>A little tip for the next time - first show how it works,If you know how something works behind the scenes you can use it`s full advantage.</p> <p>Thanks a lot for the screencasts, Yosy</p> <p><a href="http://tftheatre.org/download/?caption=download-mario-games&file=5888" title="Download Mario Games" rel="nofollow">Download Mario Games</a></p> Hi Remy, you mentioned that event delegation can helps when the DOM is changing, I agree but in addition event delegation for example can help when you have a big table with a lot of rows and you want to give the user option to change the content in the cell. For this example,event delegation would be great instead of RxC(rows multiplied by columns) events (click event for each cell).

A little tip for the next time – first show how it works,If you know how something works behind the scenes you can use it`s full advantage.

Thanks a lot for the screencasts, Yosy

Download Mario Games

]]>
By: jody http://jqueryfordesigners.com/simple-use-of-event-delegation/comment-page-1/#comment-9175 jody Fri, 17 Jun 2011 16:55:40 +0000 http://jqueryfordesigners.com/?p=343#comment-9175 <p>Thanks for linking to the screencast--that cleared the mud for me and made your tutorial all the more useful. Since watching that and your tutorial I've been doing some serious code cleaning.</p> Thanks for linking to the screencast–that cleared the mud for me and made your tutorial all the more useful. Since watching that and your tutorial I’ve been doing some serious code cleaning.

]]>
By: Bastian http://jqueryfordesigners.com/simple-use-of-event-delegation/comment-page-1/#comment-9174 Bastian Thu, 16 Jun 2011 16:04:40 +0000 http://jqueryfordesigners.com/?p=343#comment-9174 <p>Ah, thanks for this! I just ran into the same problem some days ago and yes… i solved it with copy and paste. U-uh… now I'm reformed. ;-)</p> Ah, thanks for this! I just ran into the same problem some days ago and yes… i solved it with copy and paste. U-uh… now I’m reformed. ;-)

]]>
By: RedOnion http://jqueryfordesigners.com/simple-use-of-event-delegation/comment-page-1/#comment-9173 RedOnion Thu, 16 Jun 2011 11:56:10 +0000 http://jqueryfordesigners.com/?p=343#comment-9173 <p>Great tutorial, didn't know about that. My solution had been to define a function which did all of the attaching of listeners and then call that every time the content was reloaded.</p> <p>Never liked it...</p> <p>This is great though, thanks!</p> <p><p><p><p><p><a href="http://tftheatre.org/download/?caption=hangman-game&file=10135" title="Hangman Game" rel="nofollow">Hangman Game</a></p></p></p></p> Great tutorial, didn’t know about that. My solution had been to define a function which did all of the attaching of listeners and then call that every time the content was reloaded.

Never liked it…

This is great though, thanks!

Hangman Game

]]>
By: Anselmo http://jqueryfordesigners.com/simple-use-of-event-delegation/comment-page-1/#comment-9172 Anselmo Wed, 15 Jun 2011 14:46:13 +0000 http://jqueryfordesigners.com/?p=343#comment-9172 <p>Hi, </p> <p>Other way (little more dry, but without the delegate method):</p> <p>$('#pictures<em>container').click(function(e) { var tgt = $(e.target); #get the closest img var _img</em> = tgt.closest('img'); # possible filter here if (<em>img</em>.hasClass('some<em>filtered</em>class<em>if</em>wanted')) { # call the load content here... } });</p> <p>I'm keep using this approach for dynamic content, however i really don´t know what is the performance price.</p> <p>Cheers</p> Hi,

Other way (little more dry, but without the delegate method):

$(‘#picturescontainer’).click(function(e) { var tgt = $(e.target); #get the closest img var _img = tgt.closest(‘img’); # possible filter here if (img.hasClass(‘somefilteredclassifwanted’)) { # call the load content here… } });

I’m keep using this approach for dynamic content, however i really don´t know what is the performance price.

Cheers

]]>
By: Matthew Laver http://jqueryfordesigners.com/simple-use-of-event-delegation/comment-page-1/#comment-9171 Matthew Laver Wed, 15 Jun 2011 08:44:51 +0000 http://jqueryfordesigners.com/?p=343#comment-9171 <p><p>Thanks for the video, really good as usual. I have tended to use .live() in the past. Is this the same? Or rather which situations would you use the two? Thanks.</p> <p>Sorry didn't see the earlier comments... </p></p>

Thanks for the video, really good as usual. I have tended to use .live() in the past. Is this the same? Or rather which situations would you use the two? Thanks.

Sorry didn’t see the earlier comments…

]]>