javascript - Prevent anchor click after one click -


i facing 1 issue, want disable anchor click after 1 click. have on-click attribute set in anchor tag. below html

<a style="cursor:pointer;" id="someid" onclick="myfuntion()">verify</a>      

after click "verify" changing anchors text "verifying..." , 1 more thing trying disable anchor avoid click in between verification logic going on.

i have tried event.preventdefault() , added disabled attribute anchor. nothing works.

please help!

if using jquery have done more easly.

here add new class link show has been clicked already. check when click made.

<a style="cursor:pointer;" id="someid">verify</a>

$('#someid').on('click',function(){     //check if button has class 'disabled' , function.      if(! $(this).hasclass('disabled')){         $(this).addclass('disabled');         myfuntion();         $(this).removeclass('disabled');     } }); 

Comments

Popular posts from this blog

yii2 - Yii 2 Running a Cron in the basic template -

asp.net - 'System.Web.HttpContext' does not contain a definition for 'GetOwinContext' Mystery -

mercurial graft feature, can it copy? -