Thanks Charlie, I'm a little embarassed that I wasn't able to figure
this out on my own but understand much better now.
I was beginning to get the feeling that $ = jQuery last night after
watching some tutorial screencasts and reading some articles, but for
some reason none of the resources I came across ever mentioned this
explicitly.
On probably a more in-depth note, do you know which way of accessing
the child elements yields faster-executing code? (i know the
difference is probably only a few milliseconds, but I've got some sort
of mild obsessive disorder about these kind of things)
I would guess that $("li", this) is faster because it only calls
jQuery once, but I don't know how the core works so it could be the
other way around.
On Jun 24, 9:27 pm, Charlie wrote:
> When using jQuery.js "$" is shorthand for "jQuery". It can also be used as
> shorthand in other script libraries so you will find examples using the
> longhand. For simplicity assume you are only using jquery and jquery plugins
> The following are the same:
> jQuery("div").hide();
> $("div").hide();
> The search field on jquery.com can be your best friend when learning. Enter
> "children" in search , click on the Traversing/children() link and there are
> examples for all the main element uses of jquery. Great help for learning
> syntax and new tricks
> To fix your shot in dark remove the redundant "jQuery" and brackets:$("li",
> this).animate({ top : "60px" }, 3000 );You won't find the syntax ("li" ,
> this).. used much in most examples even though it is valid
> Without knowing that syntax, using the syntax found all through majority of
> examples on jquery.com you would come up with:
> $(this).children("li").animate.(...)
> It's probably easiest to use the latter syntax to learn at first. Just
> reading these 2 it is more obvious to beginner what latter version means, and
> therefore easier to troubleshoot
> september wrote:Hello, I'm just starting with jQuery and would like to know
> the best way to identify children elements of "this" to perform animation on.
> Some Googling brought me this seemingly useful code snippet: jQuery ("img",
> this); But I don't know the correct syntax for this. Here's my newbie
> shot-in-the-dark code: $(jQuery("li", this)).animate({ top : "60px" }, 3000 );