mankii

函数:

    // 阻止默认跳转
    function stopDefault( e ) { 
         if ( e && e.preventDefault ) 
            e.preventDefault(); 
        else 
            window.event.returnValue = false; 
        return false; 
    } 

使用示例:

    // 阻止所有a标签的跳转
    $(document).ready(function(){
        $(document).on(\'click\',\'a\',function(e){
            stopDefault(e);
        });
    });

 

分类:

技术点:

相关文章: