我是jQuery
和AngularJS
的新手。我有一個簡歷作爲html文檔,如果它包含特定單詞,我想突出顯示整個鏈接。所以,jQuery查找不適用於鏈接
var checkString = $('div#htmleditior').find("a[href*=" + orphan.attributes.text + "]");
if (checkString.length > 0) {
$('div#htmleditior').find("a[href*=" + orphan.attributes.text + "]")
.addClass('mark');
isPresentInURL = true;
}
我有一個單詞的數組,我用來檢查鏈接是否包含它或不。但它不起作用?此外,我想檢查該單詞是否第二次出現,但不在URL中。我該怎麼辦 ?
是angulajs創建這個網站#htmleditior? – rrmerugu
如果'orphan.attributes.text'的值有任何空格,那麼你的選擇器將不起作用。這真的有助於在這裏看到更完整的代碼示例 –
使用超時函數,而htmleditior只是一個id,我使用text-angular來顯示html文檔,文本中沒有空格。 – ganeshk