-
-
Notifications
You must be signed in to change notification settings - Fork 484
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
limited click event to button, cleaner additional expense show
- Loading branch information
1 parent
2a4ccb0
commit a1bdb6e
Showing
1 changed file
with
5 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,11 @@ | ||
/* global $ */ | ||
|
||
function showAdditionalExpense () { | ||
for (let i = 1; i < 10; i++) { | ||
if ($(`#expense${i + 1}`).is(':hidden')) { | ||
$(`#expense${i + 1}`).wrap('<li></li>') | ||
$(`#expense${i + 1}`).removeClass('d-none') | ||
break | ||
} | ||
} | ||
$('.expense-container.d-none').first().removeClass('d-none') | ||
} | ||
|
||
$(document).on('click', '#add-another-expense', function () { | ||
showAdditionalExpense() | ||
$(() => { // JQuery's callback for the DOM loading | ||
$('#add-another-expense').on('click', function () { | ||
showAdditionalExpense() | ||
}) | ||
}) |