> 
>                 var obj = new Object;
>                 // all inputs of type text, hidden, select and textarea
>                 
> $("input:text,input:hidden,select,textarea").each(function(){
>                     eval("obj." + this.name + " = '" + this.value + "';");
>                 });

Or even:

var obj = {};
$("input:text,input:hidden,select,textarea").each(function(){
        obj[this.name] = this.value;
});

This solution avoids using eval because:

* It will still work if one of your values has a single quote (') in.
* It is faster (I think?) and cleaner.


Hope that helps,

Kelvin :)

_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to