jquery removeAttr() method
Translation results:
remove
UK[rɪˈmu:v] US[rɪˈmuv]
vt.Remove; expel; take off, take off; migrate
vi. Migrate, emigrate; leave
n. Distance, gap; move
attr
英['ətr] 美['ətr]
abbr.attractive Attractive, charming
jquery removeAttr() methodsyntax
Function: removeAttr() method removes attributes from the selected element.
Syntax: $(selector).removeAttr(attribute)
Parameters:
Parameter | Description |
attribute | Required. Specifies the attributes to remove from the specified element. |
jquery removeAttr() methodexample
<html> <head> <script type="text/javascript" src="http://apps.bdimg.com/libs/jquery/2.1.1/jquery.min.js"></script> <script type="text/javascript"> $(document).ready(function(){ $("button").click(function(){ $("p").removeAttr("style"); }); }); </script> </head> <body> <h1>这是一个标题</h1> <p style="font-size:120%;color:red">这是一个段落。</p> <p>这是另一个段落。</p> <button>删除所有 p 元素的 style 属性</button> </body> </html>
Click the "Run instance" button to view the online instance