How to avoid page refreshing on anchor () tag click?

前端 未结 3 748
面向向阳花
面向向阳花 2021-01-14 04:17

I\'m creating a dynamic website. My problem is when i click on the following tag:



        
3条回答
  •  暖寄归人
    2021-01-14 04:44

    If you are dynamically loading the content using ajax. You should probably call it in this way. This way it will work for every anchor with .s-inte class, no matter it's added dynamically or statically.

    $(document).on('click', '.s-inte',function(e){
        e.preventDefault();
    
        // Do more stuff every anchor click here...
    });
    

提交回复
热议问题