I thought one has to have jQuery source loaded first in order to use $
to target elements. I was on a webpage that doesn\'t even include any scripts but somehow
As already alluded to in the comments by @Shmiddty, it is likely due to a plugin you have installed...
You can find out by running developer tools, select 'Sources' and look at both the Sources and Content Scripts panes - is something suspiciously like jQuery in there somewhere?
Before, Chrome had an alias to document.getElementById
with the $
variable.
Recently (probably on Chrome 23 release), it has been changed to an alias to document.querySelector
.
So your code is the equivalent of document.querySelector('body')
.