Jquery select cannot be used in setTimeout

$cannot be used in setTimeout. The specific platform is that Douyu www.douyu.com, wanted to automatically close the on-screen comment and wrote a tampermonkey plug-in, so he used the following code

$("div[class^="showdanmu-"]").click()
It is normal for

F12 to be directly typed in the console. You can find the following div:

in the above statement
<div class="showdanmu-42b0ac removed-9d4c42" title=""></div>
< hr >

but not if you put it in the delay function in js. The specific code is as follows:

setTimeout(function(){$("div[class^="showdanmu-"]").click();console.log("-sharp-sharp-sharpDouyu-sharp-sharp-sharp");},5000);

the error is as follows:

VM1850:1 Uncaught ReferenceError: $ is not defined
    at <anonymous>:1:31

so I tried to simply enter

directly in the console.
setTimeout(function(){console.log(typeof($));console.log("-sharp-sharp-sharpDouyu-sharp-sharp-sharp");},5000);

get the following results

5572
VM2021:1 undefined
VM2021:1 -sharp-sharp-sharpDouyu-sharp-sharp-sharp

question: did Douyu use something similar to scope to limit the use of $in setTimeout? Front-end contact soon do not know very well, the previous version of this statement ran on Douyu everything normal recently began to find $.

plugin address:
https://greasyfork.org/script.

now the temporary solution is to add jquery references to it, but it seems to conflict with Douyu himself, resulting in abnormal loading of the concerned page, so I have to ask for help from Daniel here

.
Oct.08,2021

has been solved, because the chrome console natively supports selector like jquery, so you can directly use $. In fact, H5 adds document.querySelector just like jquery's $selector, directly replacing $with document.querySelector (so what special operation did Douyu do before $can be used normally?)

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e4617a-651a1.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e4617a-651a1.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?