Alex Rivera | Logout

How to remove "href" with Jquery?

Asked 2009-11-06T14:51:34.287
66
<a id="a$id" onclick="check($id,1)" href="javascript:void(0)"  class="black">Qualify</a>

After "href" is removed, is "Qualify" still clickable?

Edit
Report

1 Answer

30

If you want your anchor to still appear to be clickable:

$("a").removeAttr("href").css("cursor","pointer");

And if you wanted to remove the href from only anchors with certain attributes (eg ones that just have a hash mark as the href - this can be useful in asp.net)

$("a[href='#']").removeAttr("href").css("cursor","pointer");
answered 2011-02-18T19:18:52.290

Your Answer