这是删除<div>的正确jQuery吗?

chr*_*ude 1 html javascript jquery

我有以下HTML:

<div id="popups">
    <div id="createform">
        <div id="createformInside">
            <input type="text" id="testTitle" size="20">
            <input type="text" id="testSubj">
            <span id="testOptions">More Options</span>
            <br/>
            <textarea id="testContent" ></textarea>
            <input type="button" value="Save Test" id="saveBttn">
        </div>
     </div>
</div>
Run Code Online (Sandbox Code Playgroud)

下面的jQuery应该在<div>按下保存按钮时删除弹出窗口内的所有内容.出于某种原因,事实并非如此.知道为什么不呢?

$('#saveBttn').click( function() {//if the save button on the create test form is clicked...
    $('#createform').remove();//gets rid of the create test form
})
Run Code Online (Sandbox Code Playgroud)

Ben*_*owe 5

是的,这是对的.

刚刚测试了您的示例代码:http://jsfiddle.net/bFXKP/

从该演示中可以正常工作,因此可能会有其他缺失的东西.