Karl Swedberg
Member since Dec 11, 2008
- Profile: /members/1705-karl-swedberg.htm
- URL: http://www.learningjquery.com/
- Comments: 8
Recent Blog Comments By Karl Swedberg
-
Your jQuery Selector Context Can Be A jQuery Object
Posted on Mar 15, 2010 at 1:03 PM
@Ben, Yeah. By default, .live() binds events to document and uses event delegation to see if $(event.target).closest(selector) exists before executing your function. As of jQuery 1.4, you can specify a DOM element to bind to instead of document, which limits the possible elements that trigger ... read more »
-
Your jQuery Selector Context Can Be A jQuery Object
Posted on Mar 15, 2010 at 12:48 PM
There is one case in which you need a DOM node as the "context" argument: when you're using it for the .live() method. Otherwise, you're right.... read more »
-
jQuery 1.4 Reference Guide By Karl Swedberg And Jonathan Chaffer
Posted on Feb 20, 2010 at 2:59 PM
@Dan, Sorry about the late reply. We don't have any immediate plans for another edition of Learning jQuery, though I'm sure it'll happen at some point. Because it's more of a tutorial-style book, Learning jQuery 1.3 is less time sensitive than the Reference Guide is. Nearly everything in there is ... read more »
-
jQuery's Closest() Method Returns Only One Ancestor
Posted on Oct 6, 2009 at 2:56 PM
Nice article, Ben! @Aidan, I think .up() is different from .closest(). It's more like .parents(':first') or .parents(':eq(someindex)'). The .closest() method starts with the matched element itself and then works its way up the DOM tree until it finds a match -- unlike .up() and parents(), which sta... read more »
-
You Really Shouldn't Be Here jQuery, My Wife Might Begin To Suspect Something
Posted on Sep 4, 2007 at 9:14 AM
oops. I guess the comment filter didn't like my pre and code tags. sorry about that.... read more »
-
You Really Shouldn't Be Here jQuery, My Wife Might Begin To Suspect Something
Posted on Sep 4, 2007 at 9:13 AM
@Bax and Ben, jQuery does have an "every other" method that triggers on click: .toggle(fn1, fn2). This one sometimes gets lost in the mix because jQuery also has an effect method called .toggle('optionalSpeed'), which I see Bax is already using. That said, it might make more sense in this situati... read more »
-
You Really Shouldn't Be Here jQuery, My Wife Might Begin To Suspect Something
Posted on Feb 6, 2007 at 1:55 PM
D'oh! Yehuda beat me to the .siblings() section! By the way, if you're sure that every sibling of the clicked element will be an <a>, you don't need to filter by "a" (or by ".on") in the .siblings() method. Just doing $(this).siblings().whatever will work fine.... read more »
-
You Really Shouldn't Be Here jQuery, My Wife Might Begin To Suspect Something
Posted on Feb 6, 2007 at 1:29 PM
Hey Ben, Welcome to the wonderful world of jQuery! I'm also on the jQuery Project Team, and I run the Learning jQuery blog: www.learningjquery.com Like you, I was totally sold on jQuery's selector power. Speaking of which, here is another way you could do the image swap (untested): $(document).re... read more »