I am learning javascript and using RightJS. What is the difference between the following?
var thing = $('thing1')
and
var thing = document.getElementById('thing1')
I am learning javascript and using RightJS. What is the difference between the following?
var thing = $('thing1')
and
var thing = document.getElementById('thing1')
Type it into the browser's console
> $("head")
by {_: div#head, constructor: function, initialize: function, parent: function, parents: function…}
> document.getElementById("head");
<div id="head">…</div>
You can see the $ returns some sort of wrapped object and that getElementById returns an Html Node.
Check out their docs on Util.$