JQuery UI Tabs - How can I remove tab list item if corresponding content panel is empty?

If you want to remove all empty tabs, you can use this code.

If you want to remove all empty tabs, you can use this code: $(function() { var $tabs = $( "#tabs" ); $tabs.tabs(); var offst = 0; $('#tabs > div'). Each(function(index, elem) { if ($(elem).html().trim() === '') { $tabs. Tabs( "remove" , index - offst); offst++; } }); }); Here's an example on jsfiddle Notes: The reason for the offst variable is because, if you remove a tab, the indexes will change.

This caches the tabs element in $tabs so it doesn't have to call the selector multiple times. This uses the proper remove function of jQuery UI tabs.

This worked great for my problem. Many thanks! – areid Mar 30 at 10:11 @aried: You're welcome.

:) – Drackir Apr 1 at 15:14.

Try this if ($('#tabs-3'). Is(':empty')) { var tabId = $(this). Attr('id'); $('ahref$="'+tabId+'"').parent().remove(); } For given tab id this should remove the parent element (and everything within it) of an anchor which has a matching href.

Edit: btw, your third div won't match ':empty' condition unless it really is empty, ie.

I think you're on the right track, but check out $('#tabs'). Tabs('remove',index) as a better way to get rid of the unwanted tab! – Ryley Mar 21 at 21:34.

You can find the code at this link: jsfiddle.net/sJkyE/ Regards.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions