have a jquery function to automatically create tabs for a product in an e-commerce system.
function structureTabs()
{
$('#tabs').prepend('<ul id="tabbtns"></ul>');
$('#tabs h2').each(function(index){
if(index > 0)
{
$(this).before('</div><div id="tabs-'+(index+1)+'">');
}
else
{
$(this).before('<div id="tabs-'+(index+1)+'" class="jackie">');
}
var title = $(this).text();
$('#tabbtns').append('<li><a href="#tabs-' + (index+1) + '">' + title + '</a></li>');
});
$('#tabs').append('</div>');
}
Can't you put open tabs in .before () ??
Mostly the content he is trying to wrap:
<div id="tabs">
<h2>Details</h2>
details text...
<h2>tech specs</h2>
tech spec text...
<h2>Video Sample</h2>
video embed url
</div>
The eccomerce repository client cannot edit html, so you need to automatically create tabs in .js ....
source
share