I know the $ is part of JQuery's lib and I am surprised that it exist as an object in the browser console. (I'm not sure if it's just my environment)
but I can do.. $('#id')
to get the dom id of an element. Where I have been always using document.getElementById('id') to get an element before.
I can't find references to $ on MDN.
Is the $ now available everywhere and is it ok to use when getting elements with native javascript or should I still use document.getElementById?
P.S. I know I don't have jQuery being used as $( window ).height();
won't work until I paste the following in my console in a local html file with no external resources attached.
(function(d, script) {
script = d.createElement('script');
script.type = 'text/javascript';
script.async = true;
script.onload = function(){
// remote script has loaded
};
script.src = 'http://code.jquery.com/jquery-3.2.1.min.js';
script.crossorigin = 'anonymous'
d.getElementsByTagName('head')[0].appendChild(script);
}(document));