diff --git a/src/jquery.relatedselects.js b/src/jquery.relatedselects.js
index f0bbbba..cd8326e 100644
--- a/src/jquery.relatedselects.js
+++ b/src/jquery.relatedselects.js
@@ -29,7 +29,7 @@
}
// make array of select names
- $.each(opts.selects, function(){
+ $.each(opts.selects, function(key){
selects.push(key);
});
@@ -87,14 +87,14 @@
if(value.length > 0 && value !== o.loadingMessage && $next){
// reset all selects after this one
- resetAfter(elem);
+ resetAfter(elem,o);
// populate the next select
populate($select,$next,o);
// otherwise, make all the selects after this one disabled and select the first option
} else if($next){
- resetAfter(elem);
+ resetAfter(elem,o);
}
}
@@ -132,7 +132,8 @@
// build the options
$.each(data, function(i,item){
- html.push('');
+ var isObj = typeof(item) == 'object';
+ html.push('');
});
$select.html( html.join('') ).removeAttr('disabled');
@@ -157,10 +158,11 @@
return (options.length === 0 || (options.length === 1 && options.filter(':first').attr('value').length === 0)) ? false : true;
}
- function resetAfter(elem){
+ function resetAfter(elem,o){
var thispos = getPosition(elem);
for (var x=thispos+1, len=selects.length; x