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(() => {
|
requestAnimationFrame(() => {
|
||||||
this.rootUiElement.innerHTML = '';
|
this.rootUiElement.innerHTML = '';
|
||||||
this.details.forEach((detail) => {
|
this.details.forEach((detail) => {
|
||||||
const addedDetailFragment = ContactDetails.buildContactDetailBadge(detail);
|
const addedDetailFragment = this.buildContactDetailBadge(detail);
|
||||||
this.rootUiElement.appendChild(addedDetailFragment);
|
this.rootUiElement.appendChild(addedDetailFragment);
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
static buildContactDetailBadge(detail) {
|
buildContactDetailBadge(detail) {
|
||||||
const fragment = document.createDocumentFragment();
|
const fragment = document.createDocumentFragment();
|
||||||
|
|
||||||
const div = document.createElement("div");
|
const div = document.createElement("div");
|
||||||
|
|
@ -33,8 +33,9 @@ class ContactDetails {
|
||||||
|
|
||||||
const button = document.createElement("button");
|
const button = document.createElement("button");
|
||||||
button.textContent = "Eliminar";
|
button.textContent = "Eliminar";
|
||||||
button.onclick = function () {
|
button.onclick = () => {
|
||||||
removeAddedContactDetail(this);
|
this.removeDetails(detail.type, detail.value);
|
||||||
|
this.syncUi();
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -48,6 +49,10 @@ class ContactDetails {
|
||||||
|
|
||||||
let contactDetails;
|
let contactDetails;
|
||||||
|
|
||||||
|
function removeAddedContactDetail(contactDetail,) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
window.onload = () => {
|
window.onload = () => {
|
||||||
contactDetails = new ContactDetails(document.querySelector('#created-contact-details-list'));
|
contactDetails = new ContactDetails(document.querySelector('#created-contact-details-list'));
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue