removing works as well
This commit is contained in:
parent
c30be04ba0
commit
1d08be85e6
1 changed files with 9 additions and 4 deletions
|
|
@ -16,13 +16,13 @@ class ContactDetails {
|
|||
requestAnimationFrame(() => {
|
||||
this.rootUiElement.innerHTML = '';
|
||||
this.details.forEach((detail) => {
|
||||
const addedDetailFragment = ContactDetails.buildContactDetailBadge(detail);
|
||||
const addedDetailFragment = this.buildContactDetailBadge(detail);
|
||||
this.rootUiElement.appendChild(addedDetailFragment);
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
static buildContactDetailBadge(detail) {
|
||||
buildContactDetailBadge(detail) {
|
||||
const fragment = document.createDocumentFragment();
|
||||
|
||||
const div = document.createElement("div");
|
||||
|
|
@ -33,8 +33,9 @@ class ContactDetails {
|
|||
|
||||
const button = document.createElement("button");
|
||||
button.textContent = "Eliminar";
|
||||
button.onclick = function () {
|
||||
removeAddedContactDetail(this);
|
||||
button.onclick = () => {
|
||||
this.removeDetails(detail.type, detail.value);
|
||||
this.syncUi();
|
||||
return false;
|
||||
};
|
||||
|
||||
|
|
@ -48,6 +49,10 @@ class ContactDetails {
|
|||
|
||||
let contactDetails;
|
||||
|
||||
function removeAddedContactDetail(contactDetail,) {
|
||||
|
||||
}
|
||||
|
||||
window.onload = () => {
|
||||
contactDetails = new ContactDetails(document.querySelector('#created-contact-details-list'));
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue