jQuery HTML / CSS 方法 第2页

jQuery scrollTop() 方法

阅读(451)

实例 Run this code » 返回 <div> 元素的垂直滚动条位置: $("button").click(function(){ alert($("div").scrollTop()); }); 定义和用法 scrol...

jQuery scrollLeft() 方法

阅读(320)

实例 Run this code » 返回 <div> 元素的水平滚动条位置: $("button").click(function(){ alert($("div").scrollLeft()); }); 定义和用法 scro...

jQuery replaceWith() 方法

阅读(452)

实例 Run this code » 把第一个 <p> 元素替换为新的文本: $("button").click(function(){ $("p:first").replaceWith("Hello world!"); });...

jQuery replaceAll() 方法

阅读(319)

实例 Run this code » 把最后一个 <p> 元素替换为 <span> 元素: $("button").click(function(){ $("Hello world!").replaceAll("p:...

jQuery removeProp() 方法

阅读(283)

实例 Run this code » 添加并移除名为 "color" 的属性: $("button").click(function(){ var $x = $("div"); $x.prop("color","FF0000"); $x.a...

jQuery removeClass() 方法

阅读(287)

实例 Run this code » 从所有的 <p> 元素移除 "intro" 类: $("button").click(function(){ $("p").removeClass("intro"); }); 定义和用法 r...

jQuery removeAttr() 方法

阅读(348)

实例 Run this code » 从所有的 <p> 元素移除样式属性: $("button").click(function(){ $("p").removeAttr("style"); }); 定义和用法 removeAt...

jQuery remove() 方法

阅读(359)

实例 Run this code » 移除所有的 <p> 元素: $("button").click(function(){ $("p").remove(); }); 定义和用法 remove() 方法移除被选元素,包括所有的文...

jQuery prop() 方法

阅读(284)

实例 Run this code » 添加并移除名为 "color" 的属性: $("button").click(function(){ var $x = $("div"); $x.prop("color","FF0000"); $x.a...

jQuery prependTo() 方法

阅读(329)

实例 Run this code » 在每个 <p> 元素的开头插入 <span> 元素: $("button").click(function(){ $("Hello World!").prependTo("p")...