Can't unbind click event for anchor
I am trying to turn an active link to an inactive one. However,
clicking on the link now gives two alerts. Any input is appreciated.
<html>
<head>
<script language="javascript" src="jquery.js"></script>
<style type="text/css">
.lnk
{
TEXT-DECORATION: underline;
cursor: pointer;
}
.noLnk
{
TEXT-DECORATION: none;
cursor: default;
}
</style>
<script language="javascript">
$(document).ready (function ()
{
$('a').unbind ('click');
$('a').unbind ();
$('a').removeAttr ('onClick');
$('a').bind ('click', function () { alert ('<a> - Did you just
click me?' ); $(this).removeClass ("lnk").addClass ("noLnk");});
});
</script>
</head>
<body>
<a href="javascript: void 0" onClick="alert ('<a> - Why you clicked
me?')" class="lnk">Test</a>
</body>
</html>