- Use jQuery.live so that even if tabs are ajaxed in they still work.
- Don't use DOM ready since this JS file is already at the bottom of the page.
- Remove selected class only on sibling tabs.
- Don't add a selected class on selected tab if it's already there (avoid hits to the DOM).
- Avoid using $(this) a lot, and instead use a saved reference, as you're creating a new jQuery object each time.
- Use '$' in front of jQuery variables so that you know they are jQuery objects.
If this is not done, then the active class remains on the tab that was initially visible on page load - even if this tab is now hidden and no longer active. This is confusing when trying to target CSS as a the selector "ul.tabs-content > li.active" , may not be visible.
Also removed unused tabsContent variable.