Href=“#” Don't Scroll

后端 未结 11 2297
暗喜
暗喜 2020-12-05 01:55

I am pretty new to JS - so just wondering whether you know how to solve this problem.

Current I have in my code



        
11条回答
  •  天涯浪人
    2020-12-05 02:15

    JavaScript version:

    myButton.onclick=function(e){
        e.preventDefault();
        // code
        return false;
    }
    

    jQuery version:

    $('.myButtonClass').click(function(e){
        e.preventDefault();
        // code
        return false;
    });
    

    This just do the job well! :)

提交回复
热议问题