-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,226
  • 8
  • 97
  • 109
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,058
  • 6
  • 53
  • 101