Showing input focus on textboxes

Showing input focus on textboxes

I have just started using jQuery and getting familiar with the syntax.  I have a simple function I want to run that will add a "focus" class when a textbox receives focus, and remove it when it loses it.  I have the following code:

  1. $(document).ready(function () {
        $("input[type='text'], input[type='password']").focus(function () {
            $(this).addClass("inputFocus");
            alert('Handler called');
        });
        $("input[type='text'], input[type='password']").blur(function () {
            $(this).removeClass("inputFocus");
            alert('Handler called')
        });
    });









The code appears to run normally, but I don't see any alerts pop up when I give focus to a textbox or leave it.  I have examined what jQuery is doing, and it selects the dozen or so textboxes on my page correctly and iterates through them, but afterward I don't see any "onfocus" or "onblur" events as being attached in the IE Dev Tools.

These textboxes are all hidden on the page to start with, but are accessible through the DOM.

What am I missing?