jQuery removeAttr Method
jQuery removeAttr method : The primary use of the removeAttr method is used to remove attribute from the html element. Below is simple example with demo and online editor.
jQuery removeAttr Method Syntax
Here is syntax to remove attributes from html elements.
$(selector).removeAttr('attr_name');
attr_name: It is name of attribute which you want to remove.
jQuery removeAttr Method Example
Here is an example of jQuery remove Attribute method-
jQuery removeAttr() Method – Example –
<script type="text/javascript"> $(document).ready(function(){ $( "#attrExample" ).on( "click", function(event) { $("div").removeAttr("style"); }); }); </script> |
This will produce the following output –
Note : This is screenshot of the output. To run this demo click on the above Try it button.
Advertisements