IE8 Jquery Javascript "Error: Object required" Bug

Posted by thechrisvoth on Stack Overflow See other posts from Stack Overflow or by thechrisvoth
Published on 2009-04-24T18:42:49Z Indexed on 2010/03/09 10:36 UTC
Read the original article Hit count: 941

Filed under:
|
|

IE8 throws an "Error: Object required" message (error in the actual jquery library script, not my javascript file) when the switch statement in this function runs. This code works in IE6, IE7, FF3, and Safari... Any ideas? Does it have something to do with the '$(this)' selector in the switch? Thanks!

function totshirts(){
    $('.shirt-totals input').val('0');
    var cxs = 0;
    var cs = 0;
    var cm = 0;
    $.each($('select.size'), function() {
    	switch($(this).val()){
    		case "cxs":
    			cxs ++;
    			$('input[name="cxs"]').val(cxs);
    			break;
    		case "cs":
    			cs ++;
    			$('input[name="cs"]').val(cs);
    			break;
    		case "cm":
    			cm ++;
    			$('input[name="cm"]').val(cm);
    			break;
    	}
    });
}

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about JavaScript