rahul desai rahul desai - 4 months ago 46x
jQuery Question

Remove anchor tag only, but to keep inner html?

I need to write jquery, to remove the anchor tag properties, and add other properties... I cannot make direct changes inside the html, so have to do it through jquery. How can I do it?

<span id="TabnavTabLogoTextId" class="navTabButton navTabThemeButton" title="Microsoft Dynamics CRM Go to home page.">
<a title="Microsoft Dynamics CRM Go to home page." class="navTabButtonLink" onkeypress="return true;" onclick="return false;" href="javascript:;" unselectable="on">
<span id="navTabLogoTextId" class="navTabLogoTextThemeImage">
<img alt="Microsoft Dynamics CRM Microsoft Dynamics CRM" unselectable="on" src="/NFDIL/%7B636004438060001088%7D/WebResources/pcl_SiteLogo.png">


Use removeAttr to remove all attributes of anchor.


Use this when you want to add attributes back to <a>

$('a').attr('title','//yourtitle'); // and so on like this