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 );

  

Reply via email to