-3

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?

Mischa
  • 42,876
  • 8
  • 99
  • 111
omryk
  • 5
  • 1
  • 2
    One difference is that the second one takes about 10 times longer to execute. –  Jul 20 '13 at 13:55

1 Answers1

0

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

Teemu
  • 22,918
  • 7
  • 53
  • 106