Prevent onclick action with jQuery

前端 未结 5 834
春和景丽
春和景丽 2020-11-30 05:01

there are some links with onclick event actions

Let\'s panic


        
5条回答
  •  情书的邮戳
    2020-11-30 05:14

    The problem is that jQuery adds events in order. To stop other events, the events you need to stop must come after your stopping code. Since you have code in your on click, you will need to change up the order. This is what I would do:

    TEST
    TEST
    
    

    The benefit is just remove/add the disabled class using jQuery: $('a#whatever').addClass('disabled') or remove it $('a#whatever').removeClass('disabled') and no other cleanup/setup is required.

提交回复
热议问题