forked from ramrap/Expense-Calculator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.js
43 lines (25 loc) · 722 Bytes
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
//alert("hello peeps");
$(document).ready(function () {
let totalExpense=00;
const eList=$("#expense")
$("#AddBtn").click(function () {
const reasonval=$("#reason").val();
const amount =$("#amount").val();
if(reasonval==""||amount<=0){
return;
}
var ele = document.createElement("ion-item")
ele.textContent=reasonval + ": $"+amount;
eList.append(ele);
console.log(totalExpense);
totalExpense+= +amount;
console.log(totalExpense);
$("#totexp span").text(totalExpense);
$("#reason").val('');
$("#amount").val('');
});
$("#clearBtn").click(function () {
console.log("works");
eList.empty();
});
});