Click here to Skip to main content
15,899,754 members
Please Sign up or sign in to vote.
2.33/5 (2 votes)
See more:
HTML
<div id="contact">
 <div class="row">
 <div class="col-sm-4">
 <div class="form-group">
 <span class="input-icon icon-right">
 <input type="text" class="form-control" placeholder="Business Phone id="BusinessPhone" ng-model="vm.clientinfo.BusinessPhone">

 </span>
  </div>
  </div>
   <div class="col-sm-4">
  <div class="form-group">
  <span class="input-icon icon-right">
 <input type="text" class="form-control" placeholder="Fax" id="Fax" ng-model="vm.clientinfo.Fax">
    ^__i class="fa fa-lock circular">
 </span>
   </div>
 </div>
 <div class="col-sm-4">
<label>
<input type="checkbox" id="checkbox1" value=1 ng-model="vm.clientinfo.assign">
 <span class="text">Assign Password and Personal Contact Information</span>
 </label>
  </div>
  </div>
<input id="addcontactbutton" type="button" value="Add Another Contact" class="btn btn-blue" />
 <input id="removecontactbutton" type="button" value="Remove This Contact" class="btn btn-blue" />
  </div>


i want help for

1) in the above code i want to add a copy of this form on addcontactbutton with different id and different ng-modelof all the controls on above form.
2) and remove the added on button removecontactbutton click.

using jquery

thanks in advance
please help
Posted
Updated 6-Jun-16 20:51pm

1 solution

1. You can use jQuery clone() to copy the entire form
jquery clone example[^]

2. Then loop through each form and give a different id to each one of them

3. On click of the remove button, remove the respective form by making use of $(this)

I hope this would help you getting started. If you get stuck in somewhere, then please post a new question along with the code which was not working properly for you while working on it.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900