Take the 2-minute tour ×

For IE, I was trying to set the .blur so focus would be taken out of the field with the error state.

I tried to work it in below and it wasn't working, no matter what I tried. (continue reading below)

function customAlert(){
    var args = arguments;
    if(args.length > 1) {
        // check that custom alert was called with at least two arguments
        var msg = args[0];
        var div = $(".errorPopup");
        if (div.length == 0) {
            div = $("<div class='errorPopup' onclick='$(this).hide();'></div>");
            var inputID = args[i];
                $(this).unbind('focus'); // remove this handler
                $('.errorPopup').hide(); // hide error popup


So then I added .blur to the javascript validation, which works (oddly) in IE6 - if another window is open, it's removing focus from the entire browser and the browser window will minimize. Thoughts? - seems strange

case "firstName":
                        //First Name Field Validation, Return false if field is empty
                        if( f.firstName.value == "" )
                            customAlert (bnadd_msg_002,"firstName");
                            if ((typeof TeaLeaf != "undefined") && (typeof TeaLeaf.Client != "undefined") && (typeof TeaLeaf.Client.tlAddEvent != "undefined") ) {
                                var nVO = { ErrorMessage : bnadd_msg_002}
                                var subtype="CustomErrorMsg";
                                TeaLeaf.Event.tlAddCustomEvent(subtype, nVO);
                            return false;
share|improve this question
add comment

1 Answer

up vote 0 down vote accepted


share|improve this answer
where in the above code would this work. I've tried this in various places, and I keep running into the same issue. –  Jason Jul 18 '11 at 23:10
Anywhere. That code will blur/focus respectively the element immediately when called. If it's not working for you, it's possible there's some other problem going on. –  Chris Pratt Jul 19 '11 at 14:24
I got it to work - sort of - see edit. –  Jason Jul 19 '11 at 19:08
I'm missing context, so I can't say for sure, but the default value for this is window, if it hasn't been set by some other context. Since the behavior you describe screams window.blur(), I'm guessing that in the context you're calling that in this is not what you think it is. –  Chris Pratt Jul 19 '11 at 19:43
add comment

Your Answer


