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再次检查