Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to unset id attribute with jQuery?

Tags:

jquery

dom

$().attr('id','') still leaves id = "" snippet,

how to completely remove it?

like image 218
omg Avatar asked Sep 06 '09 14:09

omg


People also ask

How to remove Attr using jQuery?

The removeAttr() method is an inbuilt method in jQuery which is used to remove one or more attributes from the selected elements. Parameters: This function accepts single parameter attribute which is mandatory. It is used to specify one or more attributes to remove.

How remove data attribute value in jQuery?

jQuery removeAttr() Method The removeAttr() method removes one or more attributes from the selected elements.

How to change id of jQuery element?

I found out that I can make it happen with the following code: jQuery(this). prev("li")show(function() { this.id="newid"; });


1 Answers

Use the removeAttr method.

$('selector').removeAttr('id')
like image 126
TM. Avatar answered Sep 24 '22 09:09

TM.