-2

Can somebody explain to me what the difference is between these two examples:

var obj = getElementById("id1"); // without jQuery
var obj = $("#id1"); // with jQuery

Is the returned value in both cases the same object?

1
  • 2
    One difference is that the second one takes about 10 times longer to execute.
    – user663031
    Commented Jul 20, 2013 at 13:55

1 Answer 1

0

getElementById() returns a DOM element only, $("#id1") returns a jQuery object containing DOM element(s).

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.