Christopher Jordan schrieb:
> Yeah, that's actually where I found my answer Klaus. I'm a bit 
> embarrassed that I basically posted the question a second time. It 
> didn't immediately occur to me that I could do the same thing with 
> "input:type" that I could with ".classA". I'm not a css stud so I guess 
> I didn't think of the index:type syntax as being a css selector... what 
> I did think it was, I have no idea. :o'
> 
> Well, I appreciate everyone's patience with me.
> 
> The upshot of all this is that I managed to condense what would have 
> taken at least one-hundred lines of code down to only three... well one 
> really, except that I like to split things out on to separate lines. The 
> idea was to gather all the form fields and put their values in an object 
> such that I could pass all the variables in one single structure. Here's 
> what I ended up with:
> 
>                 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 + "';");
>                 });
> Very nice. Simple. Clean. Thank you, thank you, thank you jQuery! ... 
> and all you guys who help me with my questions no matter how basic. I am 
> learning, and I use more and more jQuery every day! :o)
> 
> Thanks heaps!
> Chris

Avoid eval whenever possible...

obj[this.name] = this.value


-- Klaus

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

Reply via email to