How to remove "href" with Jquery?

Steven picture Steven · Nov 6, 2009 · Viewed 157.1k times · Source
<a id="a$id" onclick="check($id,1)" href="javascript:void(0)"  class="black">Qualify</a>

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

Answer

Langdon picture Langdon · Nov 6, 2009

Your title question and your example are completely different. I'll start by answering the title question:

$("a").removeAttr("href");

And as far as not requiring an href, the generally accepted way of doing this is:

<a href"#" onclick="doWork(); return false;">link</a>

The return false is necessary so that the href doesn't actually go anywhere.