+ return this.each(function(){
+ if ( val.constructor == Array && /radio|checkbox/.test(this.type) )
+ this.checked = (jQuery.inArray(this.value, val) >= 0 ||
+ jQuery.inArray(this.name, val) >= 0);
+ else if ( jQuery.nodeName(this, "select") ) {
+ var tmp = val.constructor == Array ? val : [val];
+
+ jQuery("option", this).each(function(){
+ this.selected = (jQuery.inArray(this.value, tmp) >= 0 ||
+ jQuery.inArray(this.text, tmp) >= 0);
+ });
+
+ if ( !tmp.length )
+ this.selectedIndex = -1;
+ } else
+ this.value = val;
+ });