2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

jQueryのremoveAttrメソッド

Last updated at Posted at 2018-08-12

##removeAttrメソッドとは?

HTML要素の 属性 を削除するメソッド

##属性とは何ぞや

以下のコードの例だと、href,classが属性にあたる

<a href="#" class="hoge">リンクだよ</a>

##実際に削除してみよう

<a href="#" class="hoge">リンクだよ</a>
var linkAfter = $('a').removeAttr('class');

結果

classが無くなっている

<a href="#">

参考

[要素の属性を操作するには?(attr/removeAttr]
(https://www.buildinsider.net/web/jqueryref/007)
[30分で理解!jQueryのattr()で属性操作を極めるコツ!]
(https://www.sejuku.net/blog/37402)

2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?