remove
英 [r??mu:v]? ?美 [r??muv]??
vt.去除;開除;脫掉,拿下;遷移
vi.遷移,移居;離開
n.距離,差距;移動
attr
英 ['?tr]? ?美 ['?tr]??
abbr.attractive 吸引人的,有魅力的
jquery removeAttr()方法 語法
作用:removeAttr() 方法從被選元素中移除屬性。
語法:$(selector).removeAttr(attribute)
參數(shù):
參數(shù) | 描述 |
attribute? ?? | 必需。規(guī)定從指定元素中移除的屬性。 |
jquery removeAttr()方法 示例
<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>這是一個(gè)標(biāo)題</h1> <p style="font-size:120%;color:red">這是一個(gè)段落。</p> <p>這是另一個(gè)段落。</p> <button>刪除所有 p 元素的 style 屬性</button> </body> </html>
點(diǎn)擊 "運(yùn)行實(shí)例" 按鈕查看在線實(shí)例