javascript - Only run a function if on X page -
i have js set tabs on 1 page. i'd run function on page prevent undefined not function
console errors. how can include conditional if
statement this?
$(function() { $( "#tabs" ).tabs().addclass( "ui-tabs-vertical ui-helper-clearfix" ); });
so, like:
if x page { $(function() { $( "#tabs" ).tabs().addclass( "ui-tabs-vertical ui-helper-clearfix" ); }); }
if page has specific class assigned it, or element applies page, can it. this:
$(function() { if ($('body').hasclass('classname')) { $('#tabs').tabs().addclass('ui-tabs-vertical ui-helper-clearfix'); } });
Comments
Post a Comment