我正在创建一个表,该表在每次单击按钮时都会被克隆。克隆的html的语法为
<div class="prescriptionClone">
<div class="row clearfix">
<div class="col-sm-3 ">
<div class="form-group">
<div class="form-line">
<select class="form-control input-validation-error" data-val="true" data-val-required="The Medicine field is required." id="PrescriptionList_0__MedicineId" name="PrescriptionList[0].MedicineId" required="required">
<option value="">Medicine</option>
<option value="3a44fab8-7b2e-40fe-9907-fd7c34944a8e">Paracitrmal</option>
</select>
<span class="text-danger field-validation-error" data-valmsg-for="PrescriptionList[0].MedicineId" data-valmsg-replace="true"><span for="PrescriptionList_0__MedicineId" class="">The Medicine field is required.</span></span>
</div>
</div>
</div>
<div class="col-sm-2 ">
<div class="form-group">
<div class="form-line">
<select class="form-control input-validation-error" data-val="true" data-val-required="The Prescription Frequency field is required." id="PrescriptionList_0__PrescriptionFrequencyId" name="PrescriptionList[0].PrescriptionFrequencyId" required="required">
<option value="">Frequency</option>
<option value="1f7b60ac-3eb4-4f4f-b948-0f0b40e43978">Teststar</option>
<option value="d76251e4-dc4d-4f3f-8a96-25dabd7a490b">Before Food</option>
</select>
<span class="text-danger field-validation-error" data-valmsg-for="PrescriptionList[0].PrescriptionFrequencyId" data-valmsg-replace="true"><span for="PrescriptionList_0__PrescriptionFrequencyId" class="">The Prescription Frequency field is required.</span></span>
</div>
</div>
</div>
<div class="col-sm-2">
<span class="controls">
<a href="#" class="btn add">+</a>
<a href="#" class="btn remove">−</a>
</span>
</div>
</div>
</div>
现在,我希望更改要克隆的控件的ID,例如 来自
id="PrescriptionList_0__MedicineId"
name="PrescriptionList[0].MedicineId" and
data-valmsg-for="PrescriptionList[0].MedicineId",
span for="PrescriptionList_0__MedicineId"
。
我在div中有4个控件。我希望在关闭时更改控件ID。是否可以更改ID。
我的小提琴在这里Removing a div row using button click
谢谢