app.js
/* EDIT Fn, Ln, PlaceOfBirth & zipcode fields with Save & cancel code*/
EDIT Fn, Ln, PlaceOfBirth & zipcode fields with Save & cancel code
EDIT Fn Ln PlaceOfBirth & zipcode fields with Save & cancel code
function editUser(id) {
  users.forEach(function(user, i) {
    if (user.id == id) {
      $(".modal-body").empty().append(`
        <form id="updateUser" action="">
          <label for="firstname">Firstname</label>
          <input class="form-control" type="text" name="firstname" value="${user.firstname}"/>
          <label for="lastname">Lastname</label>
          <input class="form-control" type="text" name="lastname" value="${user.lastname}"/>
          <label for="placeOfBirth">Place Of Birth</label>
          <input class="form-control" type="text" name="placeOfBirth" value="${user.placeOfBirth}"/>
          <label for="zipcode">Zipcode</label>
          <input class="form-control" type="text" name="zipcode" maxLength=5 value="${user.zipcode}"/>
      `);
      $(".modal-footer").empty().append(`
          <button type="submit" class="btn btn-primary" onClick="updateUser(${id})">Save</button>
          <button type="close" class="btn btn-default" data-dismiss="modal">Cancel</button>
        </form>
      `);
    }
  });
}
function editUser ( id ) { users . forEach ( function ( user , i ) { if ( user . id == id ) { $ ( ".modal-body" ) . empty ( ) . append ( ` ${ user . firstname } ${ user . lastname } ${ user . placeOfBirth } ${ user . zipcode } ` ) ; $ ( ".modal-footer" ) . empty ( ) . append ( ` ${ id } ` ) ; } } ) ; }
EDIT Fn, Ln, PlaceOfBirth & zipcode fields with Save & cancel code
EDIT Fn Ln PlaceOfBirth & zipcode fields with Save & cancel code