2009-04-21 87 views

回答

4

使用event.preventDefault()

$('a.tab').click(function(event) { 
    event.preventDefault(); // this is the key 
    // your code here 
}); 

编辑:关于你的评论 - 只是set cache to true

$(document).ready(function() { 
    $apTabs = $("#apTabs").tabs({ 
     // ... 
     cache: true, // this does the magic 
     // ... 
    }); 
}); 
+0

感谢您的快速回答:-),但禁用默认事件将导致我选择的选项卡不显示。我需要显示从初始加载中检索的内容,只是想阻止它再次从服务器询问内容。非常感谢你。 – Matt 2009-04-21 13:16:34

1
$('#tabs').click(function(){ 
    // code 
    return false; 
}); 
0

后我供你参考代码:

$(document).ready(function() { 

     $apTabs = $("#apTabs").tabs({ 
       ajaxOptions: { async: true }, 
      cache:false, 
      add: function(event, ui) { 
       //immdeiately select the new created one 
       $apTabs.tabs('select', '#' + ui.panel.id); 
      } 

      }); 

    }); 



    <div id="apTabs"> 
    <ul> 
     <li></li> 
    </ul> 
    <div></div> 
    </div> 
相关问题