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 jQuery查找不适用于链接_Javascript_Jquery_Angularjs - Fatal编程技术网

Javascript jQuery查找不适用于链接

Javascript jQuery查找不适用于链接,javascript,jquery,angularjs,Javascript,Jquery,Angularjs,我不熟悉jQuery和AngularJS。我有一份作为html文档的简历,如果它包含一个特定的单词,我想突出显示整个链接。所以 var checkString=$('div#htmleditor').find(“a[href*=”+orphan.attributes.text+”); 如果(checkString.length>0){ $('div#htmleditor').find(“a[href*=“+orphan.attributes.text+”])) .addClass(“标记”);

我不熟悉
jQuery
AngularJS
。我有一份作为html文档的简历,如果它包含一个特定的单词,我想突出显示整个链接。所以

var checkString=$('div#htmleditor').find(“a[href*=”+orphan.attributes.text+”);
如果(checkString.length>0){
$('div#htmleditor').find(“a[href*=“+orphan.attributes.text+”]))
.addClass(“标记”);
isPresentInURL=真;
}

我有一个单词数组,用来检查链接是否包含它。但它不起作用?另外,我想检查这个词是否是第二次出现,但不在URL中。我该怎么办?

我认为您不需要使用“查找此处”,请尝试以下方法:

var checkString = $('div#htmleditior a[href*="' + orphan.attributes.text + '"]");

这是由angulajs创建的html#HTMLeditor吗?如果
orphan.attributes.text
的值中有空格,则选择器将无法工作。在这里使用超时函数查看更完整的代码示例会很有帮助,htmleditior只是一个id,我使用文本角度来显示html文档,文本中没有空格。显示html我想看看
a href
是否是
div
标记style=“color:inherit;文本装饰:inherit“>example.com获取错误,错误:语法错误,无法识别的表达式:div#htmleditior a[href*=“+orphan.attributes.text+”]”ops,忘记添加四分之一,请在@ganeshk再次检查