You need to sign in to do that
Don't have an account?
Praveen Venkata B
Disable/Enable Jquery UI tabs based on multiple conditions
I'm trying to enable to disable/Enable tabs based on multiple conditions on Visualforce page. Below is my JS and Tabs UI code:
Out of two if conditions, only the last if condition is disabling tabs even when both of the if conditions are true. When both the conditions are true, i'm getting alter messages for both but only the last if condition is actually disabling tabs but not the first if condition.
Please help me !!
Out of two if conditions, only the last if condition is disabling tabs even when both of the if conditions are true. When both the conditions are true, i'm getting alter messages for both but only the last if condition is actually disabling tabs but not the first if condition.
Please help me !!
function disableEnableTabs() { var variable1=value can be either true/false; var variable2=count of some records; var variable3=value can be either Active or Inactive; if(variable3!='Active' || variable1=='false') { $("#tabs").tabs("option", { "disabled": [2] }); alert("Into Active or False"); } if(variable2==0) { $("#tabs").tabs("option", { "disabled": [3,4] }); alert("Into Count"); } else { $("#tabs").tabs('enable'); }
<div id="tabs" clas="ui-tabs ui-widget ui-widget-content ui-corner-all" style="border:none;"> <div > <ul class="nav nav-tabs"> <li class="active"> <a href="#tab1" style="text-decoration:none; font-weight: 700; color:black">Tab A</a> </li> <li> <a href="#tab2" style="text-decoration:none; font-weight: 700;color:black">Tab B</a> </li> <li> <a href="#tab3" style="text-decoration:none; font-weight: 700;color:black">Tab C</a> </li> <li> <a href="#tab4" style="text-decoration:none; font-weight: 700;color:black">Tab D</a> </li> <li> <a href="#tab5" style="text-decoration:none; font-weight: 700;color:black">Tab F</a> </li> </ul> </div>
It looks like you may need to check if variable1 == false instead of variable1 == 'false' though, as I'm guessing variable1 is a boolean value rather than a string type.