O'Reilly Forums: Ch 3, Pg. 92 Another Way To Do Unbind - O'Reilly Forums

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Ch 3, Pg. 92 Another Way To Do Unbind

#1 User is offline   jsanfil 

  • New Member
  • Pip
  • Group: Members
  • Posts: 3
  • Joined: 19-February 12

Posted 20 February 2012 - 01:02 PM

This page shows how to remove the click event from each .guess_box element.

$(".guess_box").each( function() {
   $(this).unbind("click");


But I also tried the code below and it seems to work.

$(".guess_box").unbind("click");


Is it necessary to use "each" to explicitly loop through each element or will JQuery automatically call the unbind method on all elements that match a selector?
0

#2 User is offline   nathvarun 

  • New Member
  • Pip
  • Group: Members
  • Posts: 2
  • Joined: 25-May 12

Posted 25 May 2012 - 02:46 AM

ya you are right
0

#3 User is offline   sayitfast 

  • New Member
  • Pip
  • Group: Members
  • Posts: 6
  • Joined: 14-June 08

Posted 09 July 2012 - 10:50 AM

View Postjsanfil, on 20 February 2012 - 01:02 PM, said:

This page shows how to remove the click event from each .guess_box element.

$(".guess_box").each( function() {
   $(this).unbind("click");


But I also tried the code below and it seems to work.

$(".guess_box").unbind("click");


Is it necessary to use "each" to explicitly loop through each element or will JQuery automatically call the unbind method on all elements that match a selector?


I was here to ask the very same thing...
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users