+ Start a Discussion
Koustubh KulkarniKoustubh Kulkarni 

Change style classs of the html elment based on the Selection of checkbox?

Hi i am new to salesforce. I want to change styleclass of the html span element based on whether or not the <Apex:selectoption> is selected or not.Here is the piece code :-
 <li id="li1">
                            <a href="javascript:void(0)">
                                <apex:image url="{!URLFOR($Resource.PMO,'/PMO/images/sibarimg1.png')}"/>
                                <span>Availability</span>
                            </a>
                            <ul class="dropdown">
                                <apex:SelectCheckboxes value="{!selectedAvailability}" layout="pageDirection">
                                    <apex:selectoption itemlabel="0% (Available)" itemvalue="0" id="opt1" onclick="changeclass()"/>
                                    <apex:selectoption itemlabel="25%" itemvalue="75" id="opt2"/>    
                                    <apex:selectOption itemLabel="50%" itemValue="50" id="opt3"/>  
                                    <apex:selectOption itemLabel="75%" itemValue="25"  id="opt4"/>
                                    <apex:selectOption itemLabel="100% (Not Available)" itemValue="100" id="opt5"/>                                      
                                </apex:SelectCheckboxes>
                            </ul>
                            <!--submenu finish-->
                        </li>
I want to change style of <li> based on the selection of any of the selectoption. Any ideas, how can we do that? 
James LoghryJames Loghry
One way would be to include a javascript library like jQuery.  You would bind a function to the onchange method of your select option, and then update the style of the li element in there.  Otherwise, you can use a VF function like:
 
styleClass="{!IF(selectedAvailability == '50','myStyle','myOtherStyle')}"

and rerender the parent form with an apex:actionSupport call.
Koustubh KulkarniKoustubh Kulkarni
Thanks James for your help,but can you provide me some sample code consedering above scenario?