Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/448.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/79.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用通过JavaScript和jQuery方法选择的元素_Javascript_Jquery - Fatal编程技术网

使用通过JavaScript和jQuery方法选择的元素

使用通过JavaScript和jQuery方法选择的元素,javascript,jquery,Javascript,Jquery,我想使用一个元素,它是通过JavaScriptPrepareCeption和jQuery方法选择的,比如.css。。。可以吗 const preparecoption=document.querySelector.preparecoption; //我希望像这样使用函数,并传递上面的元素,该元素是通过vanilla JavaScript选择的 textFitprepareCaption,25; 函数textFitelement,defaultSize{ //到目前为止,我只能通过jQuery选

我想使用一个元素,它是通过JavaScriptPrepareCeption和jQuery方法选择的,比如.css。。。可以吗

const preparecoption=document.querySelector.preparecoption; //我希望像这样使用函数,并传递上面的元素,该元素是通过vanilla JavaScript选择的 textFitprepareCaption,25; 函数textFitelement,defaultSize{ //到目前为止,我只能通过jQuery选择元素来使用jQuery方法 常量文本=$'。准备选项'; //但是我想用元素参数,如下所示 常量文本=元素; //这是jQuery方法 css'font-size',defaultSize;
} 因此,您只需将$环绕元素,如图中所示

函数textFitelement,defaultSize{ 常量文本=$element; css'font-size',defaultSize; } const preparecoption=document.querySelector.preparecoption; textFitprepareCaption,25; 福


因此您只需将$around元素包装起来,如

函数textFitelement,defaultSize{ 常量文本=$element; css'font-size',defaultSize; } const preparecoption=document.querySelector.preparecoption; textFitprepareCaption,25; 福


Bar

干得好…………干得好。。。。。。。。。。。。。。