tags:

views:

46

answers:

1

I have the following code structure,

<a href="sample-test"> Text </a>

I am selecting the a using jQuery selector,

jQuery('a[href="sample-test"]').css({'backgroundColor' : 'yellow'}); 

and i want to replace the tag with any tag like <abbr></abbr>

let me know how to do it using jQuery.

+1  A: 

Try this:

jQuery('a[href="sample-test"]').replaceWith($('<abbr>' + this.innerHTML + '</abbr>');
Sarfraz