I am having problems figuring out why IE8 doesn’t like this:
//get all checked values from the checkboxes with the option_checkbox class
var values = $j('input:checkbox:checked.option_checkbox').map(function () { return this.value; }).get();
if (values.length>0){
for (x in values){
if(values[x].match("v")){ // <--this line causes a javascript error in IE8
//do something here
}
}
}
I get this error:
“Object does not support this property or method”
I am thinking I should do some other sort of validation to verify type as perhaps map() and get() are not returning what I expect (a string with the value of that particular checkbox).
Any advice?
Use
indexOf, it’s negligibly faster: