I am using jQuery UI Tabs, and I am trying to call the destroy
method prior to running the tabs, but I am not sure how to check if it has been initialized first. I want to avoid an error stating that I can't call a method before initialize.
Here is my sample code:
// destroy first
$( '.tabs' ).tabs( 'destroy' ); // throws error if not initialized first
$( '.tabs' ).tabs();
I need to destroy
first because these tabs are dynamically generated by the user (the user can add more tabs). Once the tabs are added by the user, I need to run tabs()
again, but I can't run it twice as it causes issues. Therefore I need to destroy everything first and re-run it.