[thelist] pass by value in JavaScript?
Plunkett, Matt
MPlunkett at MSA.com
Thu Apr 25 10:42:01 CDT 2002
I'm working on something where I'm trying to copy Options from one Select to
another.
I've found that this doesn't work:
form.select1.options[0] = form.select2.options[0];
I can only guess that this is because the objects are being passed by
reference, since the following DOES work, but feels ugly:
form.select1.options[0] = new Option(form.select2.options[0].text,
form.select2.options[0].value);
Is there a way to pass by value, or to copy an object?
Thanks,
Matt
More information about the thelist
mailing list