如何隐藏AJAX调用中的元素? [英] How to hide an element on an AJAX call?
本文介绍了如何隐藏AJAX调用中的元素?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个带有下拉菜单的页面,选择后使用AJAX调用创建一个新元素(一个表). Firebug实际显示了这一点:
I've got a page that has a dropdown menu, and upon selection, creates a new element (a table) using an AJAX call. Firebug shows this on action:
实际的代码是:
select name="category" id="category" onchange="load(this.value)
但是,除了创建一个新表之外,我还希望它销毁/不显示页面上已经存在的另一个表.该表具有 class ="table2" id ="PR" .我还要在上面的select标签中添加什么附加代码?谢谢
However, in addition to it creating a new table, I'd like it to destroy/ not display another table that's already on the page. The table has class="table2" id="PR". What additional code do I put into that select tag above? Thanks
推荐答案
尝试以下操作:
$('#PR').remove();
但是也许您需要创建一个函数来调用onchange:
But maybe you'll need to make a function to call onchange:
function mychange(event)
{
load( event.currentTarget.value );
$('#PR').remove();
}
select name="category" id="category" onchange="mychange(event)"
这篇关于如何隐藏AJAX调用中的元素?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文