Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove rel attribute from a tag [duplicate]

Possible Duplicate:
remove attribute of html tag

I have some jQuery in my code that adds a rel attribute to all a tags in my code. I don't want to remove the code that adds these rel attributes but instead wanted to remove these rel attributes using JavaScript/jQuery. I am able to do reset the rel attributes to empty string thus:

var $this = $(this);
var $items = $this.find('a');
$items.attr('rel', '');

Instead though, what I'd like to do is remove the rel tag altogether. Does anyone know how to do this?

like image 772
Sachin Kainth Avatar asked May 01 '12 14:05

Sachin Kainth


1 Answers

Try removeAttr() http://api.jquery.com/removeAttr/

$items.removeAttr('rel');
like image 165
mattytommo Avatar answered Nov 02 '22 23:11

mattytommo