function $(e){return document.querySelector(e)}
I use this as a shorthand for querySelector
.
For example: $('.MainClass').style.display='none';
It actually works too, but Chromes Console logger shows an error:
Uncaught SyntaxError: Failed to execute 'querySelector' on 'Document': '[object HTMLDocument]' is not a valid selector.
Which is weird, because when using $('cssslectorhere')
it still works. The reason I did this because I was so used to jQuery, that I liked the $
symbol. But I hate seeing that error in the console log, anyway to remove it?