jquery .before() no unclosed tags allowed.
have a function in jquery to automatically create the tab elements for a product in ecommerce 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>');
	}

You cannot put unclosed tabs into .before()??

Basically the content this is trying to wrap around is:

    <div id="tabs">
    <h2>Details</h2>
    details text...
    <h2>tech specs</h2>
    tech spec text...
    <h2>Video Sample</h2>
    video embed url
    </div>

The client of the eccomerce store can't edit html, so need to build the tabs automatically in .js....


jquery .before() no unclosed tags allowed.
===

have a function in jquery to automatically create the tab elements for a product in ecommerce 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>');
	}

You cannot put unclosed tabs into .before()??

Basically the content this is trying to wrap around is:

    <div id="tabs">
    <h2>Details</h2>
    details text...
    <h2>tech specs</h2>
    tech spec text...
    <h2>Video Sample</h2>
    video embed url
    </div>

The client of the eccomerce store can't edit html, so need to build the tabs automatically in .js....

