Hi,

I am trying to convert the below js code to jQuery format, since I am
using jQuery for my site. Posted below the code, your help is
appreciated.

http://woork.blogspot.com/2008/01/tabbed-search-bar-using-css-and.html

----------------------------------------------------------------------------------
<script language="javascript">
function setSearchOptions(idElement){
        /* Total Tabs above the input field (in this case there are 2 tabs:
mikode, user id) */
        tot_tab = 2;
        tab             = document.getElementById('tab'+idElement);
        search_option = document.getElementById('searchopt');
        for(i=1; i<=2; i++){
                if(i==idElement){
                        tab.setAttribute("class","selected");
                        search_option.value=idElement;
                } else {
                        
document.getElementById('tab'+i).setAttribute("class","");
                }
        }
}
</script>

                <div class="in_nobg">
                <ul class="search-options">
                        <li id="tab2"><a href="#" 
onclick="javascript:setSearchOptions
(2);">User ID</a></li>
                        <li id="tab1" class="selected"><a href="#"
onclick="javascript:setSearchOptions(1);">mikode</a></li>
                        <li id="tab0"><span>Search Contact by</span></li>
                </ul>
                <div id="search-bar">
                <form id="form1" name="form1" method="post" action="">
                <input name="" type="text" class="search-input" id="searchq"
size="40"/>
                <input name="Go" type="button" value="Go" class="search-button" 
/>
                <input type="hidden" name="searchopt" id="searchopt" />
                </form>
        </div>
----------------------------------------------------------------------------------

Thank you!

Reply via email to