File tree Expand file tree Collapse file tree 1 file changed +2
-2
lines changed
Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change 11const amountInput = document . getElementById ( "amount" ) ; //amount input
22const tipPercentInput = document . getElementById ( "tip-percent" ) ; //tip percent input
33const calculateButton = document . getElementById ( "calculate" ) ; //calculate button
4- const outputText = document . getElementById ( "output" ) ; //output text
4+ const outputText = document . getElementById ( "output" ) ; //output text area
55calculateButton . addEventListener ( "click" , ( ) => {
66 //when calculate button is pressed
77 let amount = parseFloat ( amountInput . value ) ; //get amount value
88 let tipPercent = parseFloat ( tipPercentInput . value ) ; //get tip percent value
99 let totalAmount = amount * ( 1 + tipPercent / 100 ) ; //get total billing amount
10- outputText . innerText = `Total Amount: ${ totalAmount . toFixed ( 2 ) } ` ; //format total billing amount
10+ outputText . innerText = `Total Amount: ${ totalAmount . toFixed ( 2 ) } ` ; //set output text area to format total billing amount
1111} ) ;
You can’t perform that action at this time.
0 commit comments