基本上,我使用 OnClick 调用来删除 DIV,一旦我单击 OnClick,它就会调用 remove() jQuery 函数来删除 div,
这是我当前使用 remove() 删除的 div 的代码。
<div id="add">
<button type="submit" onclick="showdiv('adduser');">Add User</button>
</div>
“showdiv”的 javascript 调用是
function showdiv(id){
$("#add").remove();
document.getElementById(id).style.display = "inherit";
}
在 div id“adduser”内,我想显示另一个按钮来执行 onclick 以带回 div id“add”,这可能吗?最好的方法是什么?
最佳答案
您可以使用 show() 和 hide() 函数,而不是使用 remove()
function showdiv(id){
$("#add").hide();
document.getElementById(id).style.display = "inherit";
}
关于javascript - jQuery remove() 检索,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14651346/