我们如何删除“<a>&#34; tag when the page has loaded</a>的价值

时间:2011-06-16 19:20:15

标签: jquery jquery-selectors

<ul class="filter-list">
<li class="filter">
<select class="field" name="field">
<select class="exclude" name="exclude">
<input class="value" type="text" autocomplete="off" value="*:*" name="value">
<a class="action remove-filter disabled" title="remove">
<span>remove</span>
</a>
<a class="action add-filter" title="add another">add another</a>
</li>
</ul>

我希望在页面加载时删除“添加另一个”标记值。我们怎么能这样做..有什么建议吗?

3 个答案:

答案 0 :(得分:3)

如果我理解正确:

$('.add-filter').remove(); //removes the <a> tag

$('.add-filter').empty(); //removes the html inside the <a> tag

答案 1 :(得分:3)

删除a元素中的文字:

$('a.action.add-filter').text('');

删除整个元素:

$('a.action.add-filter').remove();

你需要将它包装在DOM中,就像这样:

$(function(){
 $('a.action.add-filter').text('');
});

答案 2 :(得分:1)

使用jquery执行此操作

<script type="text/javascript">
    $(doucument).ready(function(){
         $('.add-filter').html("");
   });
</script>