How do I change the style of an input box in IE7 on focus?

Posted by Cen on Stack Overflow See other posts from Stack Overflow or by Cen
Published on 2010-05-31T06:11:16Z Indexed on 2010/05/31 6:12 UTC
Read the original article Hit count: 208

Filed under:
|
|
|

I know IE7 has issues...

I've read posts here and on Google telling me I need to set the style by hand onfocus() and onblur(). However, everything I try isn't working!

Here is my jQuery

    $(document).ready(function(){                       

        if (jQuery.browser.msie === true) {

        $("input.date-picker").each(function(i) 
            {
                var $foo= $(this);
                $foo.bind('onfocus onblur', function() {
                    $(this).toggleClass('smalltxt-active');
                    });

            });                

            }//end if


     });

The a corresponding box

<input name="ctl00$SelectionContent$Selections1$txtDestinationDate" type="text"
id="ctl00_SelectionContent_Selections1_txtDestinationDate" class="date-picker" 
style="width:80px;" />

I have already confirmed that my code is detecting MSIE. That I am getting a count of 2 input.date-picker objects.

Any ideas?

Thanks in advance,

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about jQuery