jQuery removeAttr( name ) Method

« Previous Chapter Next Chapter »

Description:

The removeAttr( name ) method removes an attribute from each of the matched elements.

Syntax:

Here is the simple syntax to use this method:

Example

selector.removeAttr( name )
                                        

Parameters:

Here is the description of all the parameters used by this method:

  • name: The name of the property to be removed.

Example:

Following example would remove border from each table:

Example

<html>
<head>
<title>The Selecter Example</title>
<script type="text/javascript" src="../../js/jquery-2.2.0.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>
                                        

This would generate following Output Will Be :

Example

<html>
<head>
<title>The Selecter Example</title>
<script type="text/javascript" src="../../js/jquery-2.2.0.js">
</script>
   
<script type="text/javascript" language="javascript">
   $(document).ready(function() {
     $("table").removeAttr("border");
   });
</script>
</head>
<body>
<table>
<tr><td>This is first table</td></tr>
</table>
<table>
<tr><td>This is second table</td></tr>
</table>
<table>
<tr><td>This is third table</td></tr>
</table>
</body>
</html>
                                        
Code It Online

« Previous Chapter Next Chapter »

Have Any Suggestion? We Are Waiting To Hear from YOU!

Your Query was successfully sent!