Setting CSS class to a drop down

Setting CSS class to a drop down

In my page i have a dropdown 'Type' with id 'idType', which needs to be set to focus

when the page loads (depending on whether it has a value  or not..)

 

 

/* function to apply the css to the dropdown controls while in focus

 $("select").focus(function(){

       

                        if ($(this).attr("type") != "submit")

               $(this).addClass("selected_input");

            });

 

 

 

 

/* condition applied when the page loads

if($("#idType").val() == '')

                                    {                                

                                       $("#idType").focus();                  

                                    }

 

 

 

The css class .selectedinput to be applied to the page controls in focus

 

 /* For providing  blue border to page controls*/

      .selected_input { border:2px solid #0078FF !important; margin:0 !important;}

 

 

 

The css is not getting applied to the dropdown when it is in focus. Please can you help me to find a solution since i am new to jquery