function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Praveen Venkata BPraveen Venkata B 

Jquery UI tabs enable/disable

I'm using jquery ui tabs on my Visualforce page. Below is the code:
 
<div id="tabs" clas="ui-tabs ui-widget ui-widget-content ui-corner-all">
        <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_E</a>
                </li>
            </ul>   
        </div>
I have defined each tab as below:
 
        <section id="tab1" class="tab-content active">
            <div style="padding:12px;border-right: 1px solid #C0C0C0 !important;border-left: 1px solid #C0C0C0       !important;border-bottom: 1px solid #C0C0C0 !important;">
                Content in tab 1
            </div>
        </section>

In TAB_B tab, i have a radio buttons field "Are you sure" with vaues "Yes" or "No". Upon clicking on save, i'm saving this selected value to a checkbox field "proceed__c" on to the record. If it is Yes, then check box is checked on record. And if it is No, checkbox is unchecked on record.

Now depending on the value available on the checkbox for a record, i need to enable next tab i.e., TAB_C. If the checkbox is checked on the record, i need to enable TAB_C. If it is unchecked, then even if user clicks on TAB_C, nothing should happen.

Please help to code this.
Best Answer chosen by Praveen Venkata B
Raja236Raja236

i can give you my own thought of logic
 

if(proceed__c==true){
 $("#tabc").attr("href",someurl);
}
else {
 $(#tabc).removeAttr("href");}
 



 

All Answers

Raja236Raja236
Hi

please use ids for tag's, there no disabled attribute for href

try to user jquery function 


$("#tabc").removeAttr("href")
 



 
Praveen Venkata BPraveen Venkata B

thank you for your valuable reply !!

I'll add id attribute in anchor tag for each tab as below:

TAB_A --> id="#taba"
TAB_B --> id="#tabb"
TAB_C --> id="#tabc"
TAB_D --> id="#tabd"

Can you share the code snippet like?

if(proceed__c==true){
    //enable TAB_C
​}
else if{
    //disable TAB_C
}
Raja236Raja236

i can give you my own thought of logic
 

if(proceed__c==true){
 $("#tabc").attr("href",someurl);
}
else {
 $(#tabc).removeAttr("href");}
 



 

This was selected as the best answer