weixin_33739541 2013-02-01 17:01 采纳率: 0%
浏览 22

jQuery remove()检索

Basically i'm using an OnClick call to remove a DIV, once i click the OnClick it calls the remove() jQuery function to delete a div,

here's my current code for the div that it removes using remove().

<div id="add">
<button type="submit" onclick="showdiv('adduser');">Add User</button>
</div>

The javascript call for "showdiv" is

function showdiv(id){
    $("#add").remove();
    document.getElementById(id).style.display = "inherit";
}

Inside the div id "adduser" i want to show another button to do an onclick to bring back div id "add", is that possible and what's the best way to do it ?

  • 写回答

1条回答 默认 最新

  • weixin_33688840 2013-02-01 17:02
    关注

    You can use show() and hide() functions instead of removing the div permanently using remove()

    function showdiv(id){
        $("#add").hide();
        document.getElementById(id).style.display = "inherit";
    }
    
    评论

报告相同问题?