I'm getting this error in IE8 and IE7 for some reason. I'm looping through all keys within my object and it keeps telling me Object doesn't support this property or method
on this on:
var inVal = $(inType + "#" + inName).val().trim();
The entire block is below:
for (var key in inputs) { // find all keys "brand", "name", etc. in our inputs object
var errors = false;
if (inputs.hasOwnProperty(key)) { // focus on our obj. not all others on page
var inType = inputs[key].inputType;
var inName = inputs[key].inputName;
var inVal = $(inType + "#" + inName).val().trim(); // construct input field
if (inVal == '' || inVal == null) {
errors = true;
$('#' + inName + '-error').html('');
$('#' + inName + '-error').hide().fadeIn().html(inputs[key].errorMsg);
$(inType + '#' + inName).focus();
$('#modal-loadable-inner').scrollTop(inputs[key].scrollTop);
return;
} else { // user corrected error
errors = false;
$('#' + inName + '-error').html(''); // remove error txt
}
}
}
Someone posted this on Doug Crockford's jslint boards and he responded with:
for (key in object) { if (Object.prototype.hasOwnProperty.call(object, key)) { ... } }
hasOwnProperty should have been an operator, not a method, because being a method, it is prone to these sorts of problems. But it is what it is, so you have to work around that.
Works fine in Chrome, FF, Safari, Opera, etc.. as usual. Any idea on a workaround?