li" ) 2.)...">

Assorted jQuery questions

1.) What is the difference between these two queries, exactly?

$( "#orderedlist li" )
$( "#orderedlist>li" )

2.) There is a function in the jQuery file itself that returns the following:

function now(){
    return +new Date;
}

What does it mean? I've never seen + new ones before.

3.) In a brief review of the textbook, I observed the following examples:

// use this to reset a single form
$( "#reset" ).click( function()
{
    $( "form" )[0].reset();
});

// use this to reset several forms at once
$( "#reset" ).click( function()
{
    $( "form" ).each( function()
    {
        this.reset();
    });
});

When I try to reference my own queries on array indices, they don't seem to work. However, this example became apparent when I tested it. What can i do wrong?

Edit: I will put this question to my question soon. Edit 2: Actually, I can debug it myself. Wait...

I have guesses for each of them, but I'm not completely versed in the jQuery file itself, I'm not quite sure what works here. Help evaluate.

+5
2

№ 1:

  • #orderedlist li - " ": a li - #orderedlist.
  • #orderedlist>li - " ": a li, #orderedlist.

№ 2:

plus - :

return Number(new Date);

. http://xkr.us/articles/javascript/unary-add/ - UNIX.

№ 3:

. ?

+8
  • CSS- , jQuery. "#orderedlist li" LI #orderedlist . "#orderedlist > li" LI, #orderedlist.

  • + JavaScript. , + "1" + 1 2, 11.

  • , , .

+3

All Articles