jQuery empty() 方法

jQuery 教程 · 2019-03-27 13:12:16

实例

移除所有 <div> 元素的内容:

$("button").click(function(){ $("div").empty(); });

定义和用法

empty() 方法从被选元素所有子节点和内容。

注意:该方法不会移除元素本身,或它的属性。

提示:如需移除元素,但保留数据和事件,请使用 detach() 方法。

提示:如需移除元素及它的数据和事件,请使用 remove() 方法。

语法

$(selector).empty()

点击查看所有 jQuery 教程 文章: https://codercto.com/courses/l/35.html

查看所有标签

Realm of Racket

Realm of Racket

Matthias Felleisen、Conrad Barski M.D.、David Van Horn、Eight Students Northeastern University of / No Starch Press / 2013-6-25 / USD 39.95

Racket is the noble descendant of Lisp, a programming language renowned for its elegance and power. But while Racket retains the functional goodness of Lisp that makes programming purists drool, it wa......一起来看看 《Realm of Racket》 这本书的介绍吧!

在线进制转换器
在线进制转换器

各进制数互转换器

Markdown 在线编辑器
Markdown 在线编辑器

Markdown 在线编辑器

RGB CMYK 转换工具
RGB CMYK 转换工具

RGB CMYK 互转工具