Reputation: 25294
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?
Upvotes: 2
Views: 860
Reputation: 195992
Use the .one() method which does exactly that ..
$(document).ready(function(){
$('#anch1').one('click', function() {
Record(/* your parameter */);
});
});
Upvotes: 5
Reputation: 187040
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
});
});
Upvotes: 1