Jquery-attr-remove-attribute

提供:Dev Guides
移動先:案内検索

jQuery-removeAttr(name)メソッド

説明

  • removeAttr(name)*メソッドは、一致した各要素から属性を削除します。

構文

このメソッドを使用する簡単な構文を次に示します

selector.removeAttr( name )

パラメーター

これは、この方法で使用されるすべてのパラメータの説明です-

  • name -削除するプロパティの名前。

次の例では、各テーブルから境界線を削除します

<html>
   <head>
      <title>The Selecter Example</title>
      <script type = "text/javascript"
         src = "https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js">
      </script>

      <script type = "text/javascript" language = "javascript">
         $(document).ready(function() {
            $("table").removeAttr("border");
         });
      </script>
   </head>

   <body>
      <table border = "2">
         <tr><td>This is first table</td></tr>
      </table>

      <table border = "3">
         <tr><td>This is second table</td></tr>
      </table>

      <table border = "4">
         <tr><td>This is third table</td></tr>
      </table>
   </body>
</html>

これにより、次の結果が生成されます–