是否可以使用jQuery“复制”一些表单字段(文本,广播,选择)?这些字段需要复制,但是为了验证而具有来自原件的单独ID。
如果选择“儿童计数”选项“2或更多”,则复制前面的字段。
我愿意接受建议。我希望可以通过jQuery添加列表项ID,而不必通过jQuery重新创建表单。我希望我已经很好地解释了这一点,但是让我知道它是否令人困惑。
<form method="post" enctype="multipart/form-data" target="gform_ajax_frame_2" id="gform_2" action="/about-us/publications-and-forms/youth-basketball-registration-form/#gf_2">
<div class="gform_body"><ul id="gform_fields_2" class="gform_fields top_label form_sublabel_above description_above"><li id="field_2_3" class="gfield gfield_contains_required field_sublabel_above field_description_above"><label class="gfield_label" for="input_2_3_3">Player's Name<span class="gfield_required">*</span></label><div class="ginput_complex ginput_container no_prefix has_first_name has_middle_name has_last_name no_suffix" id="input_2_3">
<span id="input_2_3_3_container" class="name_first">
<label for="input_2_3_3">First</label>
<input type="text" name="input_3.3" id="input_2_3_3" value="" aria-label="First name" tabindex="50" placeholder="First" style="cursor: auto; background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAABHklEQVQ4EaVTO26DQBD1ohQWaS2lg9JybZ+AK7hNwx2oIoVf4UPQ0Lj1FdKktevIpel8AKNUkDcWMxpgSaIEaTVv3sx7uztiTdu2s/98DywOw3Dued4Who/M2aIx5lZV1aEsy0+qiwHELyi+Ytl0PQ69SxAxkWIA4RMRTdNsKE59juMcuZd6xIAFeZ6fGCdJ8kY4y7KAuTRNGd7jyEBXsdOPE3a0QGPsniOnnYMO67LgSQN9T41F2QGrQRRFCwyzoIF2qyBuKKbcOgPXdVeY9rMWgNsjf9ccYesJhk3f5dYT1HX9gR0LLQR30TnjkUEcx2uIuS4RnI+aj6sJR0AM8AaumPaM/rRehyWhXqbFAA9kh3/8/NvHxAYGAsZ/il8IalkCLBfNVAAAAABJRU5ErkJggg==); background-attachment: scroll; background-position: 100% 50%; background-repeat: no-repeat;">
</span>
<span id="input_2_3_4_container" class="name_middle">
<label for="input_2_3_4">Middle</label>
<input type="text" name="input_3.4" id="input_2_3_4" value="" aria-label="Middle name" tabindex="51" placeholder="Middle">
</span>
<span id="input_2_3_6_container" class="name_last">
<label for="input_2_3_6">Last</label>
<input type="text" name="input_3.6" id="input_2_3_6" value="" aria-label="Last name" tabindex="52" placeholder="Last">
</span>
</div></li><li id="field_2_4" class="gfield gfield_contains_required field_sublabel_above field_description_above"><label class="gfield_label" for="input_2_4">Grade<span class="gfield_required">*</span></label><div class="ginput_container"><input name="input_4" id="input_2_4" type="number" step="any" value="" class="small" tabindex="54" placeholder="Grade"></div></li><li id="field_2_5" class="gfield gfield_contains_required field_sublabel_above field_description_above"><label class="gfield_label" for="input_2_5">Birthday<span class="gfield_required">*</span></label><div class="ginput_container">
<input name="input_5" id="input_2_5" type="text" value="" class="datepicker medium mdy datepicker_no_icon hasDatepicker" tabindex="55" placeholder="Birthday">
</div>
<input type="hidden" id="gforms_calendar_icon_input_2_5" class="gform_hidden" value="http://bgcgeneva.org/wp-content/plugins/gravityforms/images/calendar.png"></li><li id="field_2_9" class="gfield gfield_contains_required field_sublabel_above field_description_above"><label class="gfield_label">Sex<span class="gfield_required">*</span></label><div class="ginput_container"><ul class="gfield_radio" id="input_2_9"><li class="gchoice_2_9_0"><input name="input_9" type="radio" value="M" id="choice_2_9_0" tabindex="56"><label for="choice_2_9_0" id="label_2_9_0">M</label></li><li class="gchoice_2_9_1"><input name="input_9" type="radio" value="F" id="choice_2_9_1" tabindex="57"><label for="choice_2_9_1" id="label_2_9_1">F</label></li></ul></div></li><li id="field_2_8" class="gfield field_sublabel_above field_description_above"><label class="gfield_label" for="input_2_8">Ethnicity</label><div class="ginput_container"><input name="input_8" id="input_2_8" type="text" value="" class="medium" tabindex="58" placeholder="Ethnicity"></div></li><li id="field_2_6" class="gfield gfield_contains_required field_sublabel_above field_description_above"><label class="gfield_label" for="input_2_6">Phone<span class="gfield_required">*</span></label><div class="ginput_container"><input name="input_6" id="input_2_6" type="tel" value="" class="medium" tabindex="59" placeholder="Phone"></div></li><li id="field_2_7" class="gfield gfield_contains_required field_sublabel_above field_description_above"><label class="gfield_label" for="input_2_7_1">Address<span class="gfield_required">*</span></label>
<div class="ginput_complex ginput_container has_street has_street2 has_city has_state has_zip" id="input_2_7">
<span class="ginput_full address_line_1" id="input_2_7_1_container">
<label for="input_2_7_1" id="input_2_7_1_label">Street Address</label>
<input type="text" name="input_7.1" id="input_2_7_1" value="" tabindex="60" placeholder="Address">
</span><span class="ginput_full address_line_2" id="input_2_7_2_container">
<label for="input_2_7_2" id="input_2_7_2_label">Address Line 2</label>
<input type="text" name="input_7.2" id="input_2_7_2" value="" tabindex="61" placeholder="Address Line 2">
</span><span class="ginput_left address_city" id="input_2_7_3_container">
<label for="input_2_7_3" id="input_2_7_3_label">City</label>
<input type="text" name="input_7.3" id="input_2_7_3" value="" tabindex="62" placeholder="City">
</span><span class="ginput_right address_state" id="input_2_7_4_container">
<label for="input_2_7_4" id="input_2_7_4_label">State</label>
<select name="input_7.4" id="input_2_7_4" tabindex="63"><option value="">State</option><option value="Alabama">Alabama</option><option value="Alaska">Alaska</option><option value="Arizona">Arizona</option><option value="Arkansas">Arkansas</option><option value="California">California</option><option value="Colorado">Colorado</option><option value="Connecticut">Connecticut</option><option value="Delaware">Delaware</option><option value="District of Columbia">District of Columbia</option><option value="Florida">Florida</option><option value="Georgia">Georgia</option><option value="Hawaii">Hawaii</option><option value="Idaho">Idaho</option><option value="Illinois">Illinois</option><option value="Indiana">Indiana</option><option value="Iowa">Iowa</option><option value="Kansas">Kansas</option><option value="Kentucky">Kentucky</option><option value="Louisiana">Louisiana</option><option value="Maine">Maine</option><option value="Maryland">Maryland</option><option value="Massachusetts">Massachusetts</option><option value="Michigan">Michigan</option><option value="Minnesota">Minnesota</option><option value="Mississippi">Mississippi</option><option value="Missouri">Missouri</option><option value="Montana">Montana</option><option value="Nebraska">Nebraska</option><option value="Nevada">Nevada</option><option value="New Hampshire">New Hampshire</option><option value="New Jersey">New Jersey</option><option value="New Mexico">New Mexico</option><option value="New York" selected="selected">New York</option><option value="North Carolina">North Carolina</option><option value="North Dakota">North Dakota</option><option value="Ohio">Ohio</option><option value="Oklahoma">Oklahoma</option><option value="Oregon">Oregon</option><option value="Pennsylvania">Pennsylvania</option><option value="Rhode Island">Rhode Island</option><option value="South Carolina">South Carolina</option><option value="South Dakota">South Dakota</option><option value="Tennessee">Tennessee</option><option value="Texas">Texas</option><option value="Utah">Utah</option><option value="Vermont">Vermont</option><option value="Virginia">Virginia</option><option value="Washington">Washington</option><option value="West Virginia">West Virginia</option><option value="Wisconsin">Wisconsin</option><option value="Wyoming">Wyoming</option><option value="Armed Forces Americas">Armed Forces Americas</option><option value="Armed Forces Europe">Armed Forces Europe</option><option value="Armed Forces Pacific">Armed Forces Pacific</option></select>
</span><span class="ginput_left address_zip" id="input_2_7_5_container">
<label for="input_2_7_5" id="input_2_7_5_label">ZIP Code</label>
<input type="text" name="input_7.5" id="input_2_7_5" value="" tabindex="65" placeholder="Zip">
</span><input type="hidden" class="gform_hidden" name="input_7.6" id="input_2_7_6" value="United States">
<div class="gf_clear gf_clear_complex"></div>
</div></li><li id="field_2_10" class="gfield gfield_contains_required field_sublabel_above field_description_above"><label class="gfield_label" for="input_2_10_3">Parent/Guardian Name<span class="gfield_required">*</span></label><div class="ginput_complex ginput_container no_prefix has_first_name no_middle_name has_last_name no_suffix" id="input_2_10">
<span id="input_2_10_3_container" class="name_first">
<label for="input_2_10_3">First</label>
<input type="text" name="input_10.3" id="input_2_10_3" value="" aria-label="First name" tabindex="67" placeholder="Parent/Guardian First Name">
</span>
<span id="input_2_10_6_container" class="name_last">
<label for="input_2_10_6">Last</label>
<input type="text" name="input_10.6" id="input_2_10_6" value="" aria-label="Last name" tabindex="69" placeholder="Parent/Guardian Last Name">
</span>
</div></li><li id="field_2_11" class="gfield gfield_contains_required field_sublabel_above field_description_above"><label class="gfield_label" for="input_2_11">Parent/Guardian Email<span class="gfield_required">*</span></label><div class="ginput_container">
<input name="input_11" id="input_2_11" type="email" value="" class="medium" tabindex="71" placeholder="Parent/Guardian Email">
</div></li><li id="field_2_12" class="gfield gfield_contains_required field_sublabel_above field_description_above"><label class="gfield_label" for="input_2_12_3">Emergency contact other than parent/guardian<span class="gfield_required">*</span></label><div class="ginput_complex ginput_container no_prefix has_first_name no_middle_name has_last_name no_suffix" id="input_2_12">
<span id="input_2_12_3_container" class="name_first">
<label for="input_2_12_3">First</label>
<input type="text" name="input_12.3" id="input_2_12_3" value="" aria-label="First name" tabindex="73" placeholder="First">
</span>
<span id="input_2_12_6_container" class="name_last">
<label for="input_2_12_6">Last</label>
<input type="text" name="input_12.6" id="input_2_12_6" value="" aria-label="Last name" tabindex="75" placeholder="Last">
</span>
</div></li><li id="field_2_13" class="gfield gfield_contains_required field_sublabel_above field_description_above"><label class="gfield_label" for="input_2_13">Emergency contact phone number other than parent/guardian<span class="gfield_required">*</span></label><div class="ginput_container"><input name="input_13" id="input_2_13" type="tel" value="" class="medium" tabindex="77"></div></li><li id="field_2_26" class="gfield gfield_contains_required field_sublabel_above field_description_above"><label class="gfield_label">Player's Shirt Size<span class="gfield_required">*</span></label><div class="ginput_container"><ul class="gfield_radio" id="input_2_26"><li class="gchoice_2_26_0"><input name="input_26" type="radio" value="Child Sm" id="choice_2_26_0" tabindex="78"><label for="choice_2_26_0" id="label_2_26_0">Child Sm</label></li><li class="gchoice_2_26_1"><input name="input_26" type="radio" value="Child Med" id="choice_2_26_1" tabindex="79"><label for="choice_2_26_1" id="label_2_26_1">Child Med</label></li><li class="gchoice_2_26_2"><input name="input_26" type="radio" value="Child Lg" id="choice_2_26_2" tabindex="80"><label for="choice_2_26_2" id="label_2_26_2">Child Lg</label></li><li class="gchoice_2_26_3"><input name="input_26" type="radio" value="Adult Sm" id="choice_2_26_3" tabindex="81"><label for="choice_2_26_3" id="label_2_26_3">Adult Sm</label></li><li class="gchoice_2_26_4"><input name="input_26" type="radio" value="Adult Med" id="choice_2_26_4" tabindex="82"><label for="choice_2_26_4" id="label_2_26_4">Adult Med</label></li><li class="gchoice_2_26_5"><input name="input_26" type="radio" value="Adult Lg" id="choice_2_26_5" tabindex="83"><label for="choice_2_26_5" id="label_2_26_5">Adult Lg</label></li><li class="gchoice_2_26_6"><input name="input_26" type="radio" value="Adult XL" id="choice_2_26_6" tabindex="84"><label for="choice_2_26_6" id="label_2_26_6">Adult XL</label></li></ul></div></li><li id="field_2_15" class="gfield gfield_price gfield_price_2_15 gfield_product_2_15 gfield_contains_required field_sublabel_above field_description_above"><label class="gfield_label">Child Count<span class="gfield_required">*</span></label><div class="ginput_container"><ul class="gfield_radio" id="input_2_15"><li class="gchoice_2_15_0"><input name="input_15" type="radio" value="One Child|70" id="choice_2_15_0" tabindex="85" onclick="gf_apply_rules(2,[32,28,29,30,31]);"><label for="choice_2_15_0" id="label_2_15_0">One Child</label></li><li class="gchoice_2_15_1"><input name="input_15" type="radio" value="2 or more|90" id="choice_2_15_1" tabindex="86" onclick="gf_apply_rules(2,[32,28,29,30,31]);"><label for="choice_2_15_1" id="label_2_15_1">2 or more</label></li></ul></div></li><li id="field_2_33" class="gfield gform_validation_container field_sublabel_above field_description_above"><label class="gfield_label" for="input_2_33">Comments</label><div class="gfield_description">This field is for validation purposes and should be left unchanged.</div><div class="ginput_container"><input name="input_33" id="input_2_33" type="text" value="" autocomplete="off"></div></li>
</ul></div>
<div class="gform_footer top_label"> <input type="submit" id="gform_submit_button_2" class="gform_button button" value="Submit" tabindex="111" onclick="if(window["gf_submitting_2"]){return false;} if( !jQuery("#gform_2")[0].checkValidity || jQuery("#gform_2")[0].checkValidity()){window["gf_submitting_2"]=true;} "> <input type="hidden" name="gform_ajax" value="form_id=2&title=&description=&tabindex=49">
<input type="hidden" class="gform_hidden" name="is_submit_2" value="1">
<input type="hidden" class="gform_hidden" name="gform_submit" value="2">
<input type="hidden" class="gform_hidden" name="gform_unique_id" value="">
<input type="hidden" class="gform_hidden" name="state_2" value="WyJ7XCIxNVwiOltcImJhMDk1MTA1MTBmY2Q4NWIxMmQxMGMzODhlMmUyZjgyXCIsXCI0YjQ2NDE1YWMyMTAwNzFjYWU0NDE3M2I1MzY0ZWU1ZVwiXX0iLCJmMTZmNWI3ZGFiNjJjZDJkMmRjMTljMTFjMGJkM2Y1YSJd">
<input type="hidden" class="gform_hidden" name="gform_target_page_number_2" id="gform_target_page_number_2" value="0">
<input type="hidden" class="gform_hidden" name="gform_source_page_number_2" id="gform_source_page_number_2" value="1">
<input type="hidden" name="gform_field_values" value="">
</div>
</form>