bmsterling schrieb:
> Hey guys and gals,
>
> I am trying to duplicate a set of form elements using:
>
> $("#claims").clone().appendTo("#ap")
>
> and
>
> <div id="claims">
>
> <div class="fieldlabel"><input type="text" class="contact"
> name="claim[]"
> value=""/></div>
> <div class="fieldinput">
> <select name="result[]">
> <option value="denied">Denied</option>
> <option value="granted">Granted</option>
> <option value="remanded">Remanded</option>
> </select>
> </div>
>
> <div class="clear padding"></div>
>
> </div>
>
> which works fine, but if there is text in the form element that also gets
> duplicated. I tried:
>
> $("#claims").clone().siblings(".contact").val("").appendTo("#ap")
>
> and that give me an error.
>
> Any tips?
>
> thanks
>
You have a destructive function in your chain, which alters the original
jQuery object (siblings()), try another sequence and use find instead of
siblings to find children:
$("#claims").clone().appendTo("#ap").find("input.contact").val("");
Also note that I changed the selector to "input.contact" for better
performance.
-- Klaus
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/