小白教程
所有教程
关于
Search
172.69.6.176
172.69.6.176
参数设置
贡献
退出
操作
编辑
移动
保护
信息
历史
删除
查看“Html removeprop”的源代码
本页内容
上一节:
Html_removeclass
下一节:
Html_replaceall
因为以下原因,您没有权限编辑本页:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
{{DISPLAYTITLE:removeProp()}}[[Category:jquery ref html|29]] = jQuery removeProp() 方法 = [[jquery ref html|jQuery HTML/CSS 方法]] 添加并移除名为 "color" 的属性: <sample title="" desc="" lang="html" hererun="1"> $("button").click(function(){ var $x = $("div"); $x.prop("color","FF0000"); $x.append("The color 属性: " + $x.prop("color")); $x.removeProp("color"); }); </sample> <run name=""> <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>小白教程(xiaobai.wang)</title> <meta charset="utf-8"> <script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js"> </script> <script> $(document).ready(function(){ $("button").click(function(){ var $x = $("div"); $x.prop("color","FF0000"); $x.append("color 属性值为: " + $x.prop("color")); $x.removeProp("color"); $x.append("<br>现在 color 属性值为: " + $x.prop("color")); }); }); </script> </head> <body> <button>添加和删除属性</button> <br><br> <div></div> </body> </html> </run> == 定义和用法 == removeProp() 方法移除由 [[html prop|prop()]] 方法设置的属性。 '''注意:'''不要使用该方法来移除诸如 style、id 或 checked 之类的 HTML 属性。请使用 [[html removeattr|removeAttr()]] 方法代替。 == 语法 == <pre> $(selector).removeProp(property)</pre> {| class="table table-striped table-hover" ! 参数 ! 描述 |- | property | 规定要移除的属性的名称。 |} [[jquery ref html|jQuery HTML/CSS 方法]]
返回至“
Html removeprop
”。
上一节:
Html_removeclass
下一节:
Html_replaceall