I am trying to make my own version of jQuery. I am using this code so far, to test my selectors:
js(".hide");
function js(selector){
var applyTo = document.querySelector(selector);
applyTo.style.color = 'red';
}
However, this does not work, and the error console said:
Uncaught TypeError: Cannot read property 'style' of null
Why is applyTo
null?