Reputation:
I have this code:
$(document).ready(function() {
$('.tabs-container').tabs({
tabs: '.bar',
tabs_container: '.foo'
});
});
Sometimes the tabs plugin script isn't loaded which causes the rest of the page's js to break due to this error in the console:
TypeError: $(...).tabs is not a function
How can I check to see if tabs function exists before attaching that plugin to an element?
Upvotes: 3
Views: 173