Skip to content

Commit 5cad46d

Browse files
committed
NGSTACK-922 add missing unary + operator in front of date, add event listener for remove button on existing elements
1 parent 95d9c88 commit 5cad46d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

bundle/Resources/public/admin/js/multientry.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ class MultiEntry {
6464
}
6565

6666
next_id() {
67-
const timestamp = new Date();
67+
const timestamp = +new Date();
6868

6969
return `${timestamp}${this.id++}`;
7070
}
@@ -86,6 +86,9 @@ class MultiEntry {
8686
setup_dom() {
8787
this.$element.querySelectorAll(SELECTORS.item).forEach(($item) => {
8888
$item.append(MultiEntry.create_element_from_string(this.remove_button_template));
89+
$item.querySelector(SELECTORS.remove_button).addEventListener('click', () => {
90+
this.remove($item);
91+
});
8992
});
9093
}
9194

0 commit comments

Comments
 (0)