Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/77.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 Greasemonkey不能使用jQuery';什么是全功率?_Javascript_Jquery_Greasemonkey - Fatal编程技术网

Javascript Greasemonkey不能使用jQuery';什么是全功率?

Javascript Greasemonkey不能使用jQuery';什么是全功率?,javascript,jquery,greasemonkey,Javascript,Jquery,Greasemonkey,我正在尝试使用jQuery查找元素,但它不起作用。。我发现这种选择器在Greasemonkey中是做不到的: ($("#app7019261521_hover_container > [id^=app7019261521_the_coin]")) 请帮我翻译成原始Javascript。这种选择器是Javascript中的核心。请帮帮我Javascript大师 这应该可以做到,现在我想起了我为什么开始使用jQuery: var children = document.getElementB

我正在尝试使用jQuery查找元素,但它不起作用。。我发现这种选择器在Greasemonkey中是做不到的:

($("#app7019261521_hover_container > [id^=app7019261521_the_coin]"))

请帮我翻译成原始Javascript。这种选择器是Javascript中的核心。请帮帮我Javascript大师

这应该可以做到,现在我想起了我为什么开始使用jQuery:

var children = document.getElementById('app7019261521_hover_container').childNodes;
var ids = []; //to store the IDs of all matching elements
for(var i = 0; i < children.length; i++)
{
    //indexOf returns zero is subject starts with passed string
    if(children.item(i).id.indexOf('app7019261521_the_coin') == 0)
    {
        alert('Got One!');
        ids.push(children.item(i).id);
    }
}
var children=document.getElementById('app7019261521\u hover\u container').childNodes;
var-id=[]//存储所有匹配元素的ID
对于(变量i=0;i
由于您的目标是直接针对Firefox,因此您可能需要查看在上实现的功能

检查功能:

var elements = document.querySelectorAll("#app7019261521_hover_container > [id^=app7019261521_the_coin]")

如果这能奏效,我会感到惊讶。如果jQuery不起作用,那么这也不应该,毕竟,在功能强大的浏览器中,jQuery(Sizzle)使用document.querySelectorAll…这在GreaseMonkey中对我很有效。