jQuery中removeAttr()方法用法实例
2015-01-05 00:00
756 查看
本文实例讲述了jQuery中removeAttr()方法用法。分享给大家供大家参考。具体分析如下:
此方法从匹配元素中移除相应的属性。
语法结构:
参数列表:
参数
描述
attribute
定义要从匹配元素中移除的属性
实例代码:
在以上代码中,点击按钮可以删除移除class属性。
希望本文所述对大家的jQuery程序设计有所帮助。
此方法从匹配元素中移除相应的属性。
语法结构:
$(selector).removeAttr(attribute)
参数列表:
参数
描述
attribute
定义要从匹配元素中移除的属性
实例代码:
<!DOCTYPE html> <html> <head> <meta charset=" utf-8"> <meta name="author" content="http://www.jb51.net/" /> <title>脚本之家</title> <style type="text/css"> div{ height:200px; width:200px; border:1px solid blue } .reset{ font-size:20px; color:green; } </style> <script type="text/javascript" src="mytest/jQuery/jquery-1.8.3.js"></script> <script type="text/javascript"> $(document).ready(function(){ $("#btn").click(function(){ $("div").removeAttr("class"); }) }) </script> </head> <body> <div class="reset">脚本之家欢迎您</div> <button id="btn">点击查看效果</button> </body> </html>
在以上代码中,点击按钮可以删除移除class属性。
希望本文所述对大家的jQuery程序设计有所帮助。
相关文章推荐
- JQuery中attr方法和removeAttr方法用法实例
- jQuery中removeClass()方法用法实例
- jQuery使用attr()方法同时设置多个属性值用法实例
- jQuery中remove()方法用法实例
- jQuery中removeClass()方法用法实例
- JQuery中attr方法和removeAttr方法用法实例
- jQuery中remove()方法用法实例
- jQuery中attr()方法用法实例
- jQuery中removeClass()方法用法实例
- jQuery中attr()方法用法实例
- jQuery中height()方法用法实例
- jquery中post方法用法实例
- jQuery中after()方法用法实例
- Jquery下attr和removeAttr的使用方法
- jQuery中height()方法用法实例
- jQuery中hide()方法用法实例
- jQuery中prepend()方法用法实例
- jQuery中width()方法用法实例
- jQuery中animate()方法用法实例
- jQuery中detach()方法用法实例