Jou*_*key 190
是$target.remove();
你在找什么?
http://docs.jquery.com/Manipulation/remove
Luk*_*uke 46
如果你想完全摧毁目标,你有几个选择.首先,您可以如上所述从DOM中删除对象...
console.log($target); // jQuery object
$target.remove(); // remove target from the DOM
console.log($target); // $target still exists
Run Code Online (Sandbox Code Playgroud)
选项1 - 然后用空的jQuery对象替换target (jQuery 1.4+)
$target = $();
console.log($target); // empty jQuery object
Run Code Online (Sandbox Code Playgroud)
选项2 - 或完全删除属性(如果您在别处引用它将导致错误)
delete $target;
console.log($target); // error: $target is not defined
Run Code Online (Sandbox Code Playgroud)
更多阅读:有关空jQuery对象的信息,以及有关删除的信息
归档时间: |
|
查看次数: |
150047 次 |
最近记录: |