Using jQuery UI tabs - and I've written a plugin that integrates with ui tabs.
I've got the plugin setup to initiate jQuery UI tabs if it .tabs()
hasn't been called, but this just does a simple class check:
if(!$globalTabs.hasClass("ui-tabs")){
$globalTabs.tabs();
}
But this is problematic, because often to avoid FOUC, developers add in the UI classes to the the tabs to get a better initial render before document.ready.
I could check for a different class, such as `ui-widget1, but wondering if there's another/better way?
You can query the attached widget with data():
This behavior is documented in the Widget factory page of jQuery UI's Development & Planning Wiki:
Update: From jQuery UI 1.9 onwards, the widget key becomes the widget's fully qualified name, with dots replaced with dashes, as in:
Using unqualified names is still supported in 1.9 but is deprecated, and support will be dropped in 1.10.
somehow it causes some error when i try to check the instance.
i need to reinitialize the tabs and for me a try catch did the trick:
and after that just initialize again: