Treehouse: Grow your CSS skills. Land your dream job.

javascrip code

  • # July 20, 2013 at 9:47 am

    hello people
    can somebody explain to me whats the deffirence between the two examples :

    var obj= getElementById (“id1″); //without jquery

    var obj= $(“#id1″); // with jquery

    is the returned value in both cases are the same object?


    # July 20, 2013 at 12:35 pm

    Nope, the first returns the element and the second returns a jQuery object containing the element. `$(‘#id1′)[0]` returns the same object as the first.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.