views:

107

answers:

2

The code is:

<a href="#" style="color:black" onClick="Record($id)">Done</a>  

I want this part becomes unclickable once if it is clicked, how to achieve this using Jquery or Javascript?

+1  A: 

Provide the anchor tag an id and remove the onclick handler from the HTML markup.

<a id="anch1" href="#" style="color:black">Done</a>  

$(function(){
    $("#anch1").bind("click",function(){
        // do your action here
        $(this).unbind("click"); //unbinds the click event
    });
});
rahul
+5  A: 

Use the .one() method which does exactly that ..

$(document).ready(function(){

   $('#anch1').one('click', function() {
      Record(/* your parameter */);
    });

});
Gaby