Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jun 14th, 2012  |  syntax: None  |  size: 0.91 KB  |  hits: 16  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Prevent an exception with jQuery UI Tabs
  2. $("#tabs").tabs("add","#tabContent0","CLICK ME TO CHANGE PAGE",0);
  3. $('a[href="#tabContent0"]').attr("href","javascript:window.location='http://www.google.co.uk';");
  4.        
  5. $('#tabs').bind('tabsselect', function(event, ui) {
  6.  
  7. if(ui.index<2) //ignore this will change to get current tab count -1 (so the end tab is left as it is
  8. {
  9.         window.location=$('#'+ui.tab).attr("href"); //attr href is undefined, how do i use ui.tab properly to get the right url
  10.         return false;
  11. }
  12.  
  13. });
  14.        
  15. $("#tabs").tabs("add","#tabContent0","CLICK ME TO CHANGE PAGE",0);
  16. $('a[href="#tabContent0"]').click(function() {
  17.     document.location='http://www.google.co.uk/';
  18. });
  19.        
  20. $('#example').tabs({
  21.     select: function(event, ui) {
  22.         var url = $.data(ui.tab, 'load.tabs');
  23.         if( url ) {
  24.             location.href = url;
  25.             return false;
  26.         }
  27.         return true;
  28.     }
  29. });