jQuery removeAttr()メソッド
例
すべての<p>要素からstyle属性を削除します。
$("button").click(function(){
$("p").removeAttr("style");
});
定義と使用法
removeAttr()メソッドは、選択した要素から1つ以上の属性を削除します。
構文
$(selector).removeAttr(attribute)
Parameter | Description |
---|---|
attribute | Required. Specifies one or more attributes to remove. To remove several attributes, separate the attribute names with a space |
自分で試してみてください-例
からidおよびclass属性を削除する方法。