2012-12-14 38 views

回答

1

如果你想刪除所有yes,你可以這樣做:如果你想刪除所有文本節點

$(function(){ 
    $('em').each(function(){ 
     $(this).html($(this).html().replace(/yes/g, '')); 
    }); 
}); 

Demonstration

,你可以這樣做:

$('em').contents().filter(function() { 
    return this.nodeType == 3; 
}).remove();​ 
1

如果我已經理解了你的問題,你需要使你使用的選擇器專用於a元素。試試這個:

alert($("em a").text()); // = not 
0

你有沒有試着用:

$('em').text($('em a').text()); 

反正你需要加載的jQuery或將無法正常工作