I need a way to auto-populate jquery Tab controls by grabbing bits from the html that is output by drupal. Can anyone offer suggestions? Right now the UI script goes haywire and creates it's own set of div's to match the navigation. At that point the tabs break. I am by no means a javascript or jquery pro so excuse my simple code ;)
<!DOCTYPE html>
jQuery UI Tabs (Auto create tabs)
<link type="text/css" href="http://jqueryui.com/latest/themes/base/ui.all.css" rel="stylesheet" />
<script type="text/javascript" src="http://jqueryui.com/latest/jquery-1.3.2.js"></script>
<script type="text/javascript" src="http://jqueryui.com/latest/ui/ui.core.js"></script>
<script type="text/javascript" src="http://jqueryui.com/latest/ui/ui.tabs.js"></script>
<script type="text/javascript">
$(function(){
$('div.tab-body .title').each( function(i){
var Str = $(this).text();
var li = '<li><a href="#link">' + Str + '</a></li>';
$('ul.tabs').append(li);
$('ul.tabs li a').each( function(i){
$(this).attr("href", ('div' + ++i));
})
})
});
$(function(){
$('#tabs').tabs();
});
</script>
<style>
body {font: 12px/14px "Lucida Grande", Lucida, Verdana, sans-serif;padding:50px;}
.demoHeaders {width:330px;border:1px #ccc solid;padding:15px;margin-bottom:20px;}
.tab-body {padding: 15px}
</style>
</head>
<body>
<div class="demoHeaders">
The purpose of the test is to find a way to auto-populate tab navigation for jQuery UI Tabs.
This would be particularly useful for Drupal Views that are grouped according to field data.
<br /><br />
<a href="works.html">A link to regular tabs </a>
</div>
<div id="tabs">
<ul class="tabs">
<!-- TABS GO HERE -->
</ul>
<div id="tabs-1" class="tab-body">
<div class="title">Aug</div>
<ul>
<li>Outdoor Adventure Club -- Thu, 2009-08-31 09:00</li>
</ul>
</div>
<div id="tabs-2" class="tab-body">
<div class="title">Sept</div>
<ul>
<li>Outdoor Adventure Club -- Thu, 2009-09-31 09:00</li>
</ul>
</div>
<div id="tabs-3" class="tab-body">
<div class="title">Oct</div>
<ul>
<li>Outdoor Adventure Club -- Thu, 2009-10-31 09:00</li>
</ul>
</div>
<div id="tabs-4" class="tab-body">
<div class="title">Nov</div>
<ul>
<li>Outdoor Adventure Club -- Thu, 2009-11-31 09:00</li>
</ul>
</div>
<div id="tabs-5" class="tab-body">
<div class="title">Dec</div>
<ul>
<li>Outdoor Adventure Club -- Thu, 2009-12-31 09:00</li>
</ul>
</div>
</div>
</body>