JohnC1 JohnC1 - 3 months ago 9x
jQuery Question

Use $(Selector) without jQuery

I am currently using something like this:

function Select(query)
return query[0] === '#' ? document.querySelector(query) : document.querySelectorAll(query);

I have to use it like:

Select('#id').innerHTML = "content", or Select('.class')

Is there a way I can use $('#id) or $('.class') without jQuery?


Add window.$=Select or change name of function to $

This won't enhance any capabilities...just shorten the code when you use it