Question: JavaScript question here, how do I create a Tip Calculator form with HTML and CSS where the form has a text input so that users

JavaScript question here, how do I create a Tip Calculator form with HTML and CSS where the form has a text input so that users can enter their bill amount and submit it (via a submit button). The JavaScript should calculate the tip amount based on the bill amount. Important, the tip should be displayed as a percentage of the bill amount (I don't know how to do that. help please). Edit the JavaScript to work with your updated HTML design.

Here is the JavaScript code:

const button = document.querySelector("button"); const output = document.querySelector(".output"); console.log(button); button.addEventListener("click", function() { const cost = document.querySelector("input"); console.log(cost.value * 0.15); let tip = (cost.value * 0.15).toFixed(2); let temp = `

You should tip $${tip} on $${cost.value}

`; output.innerHTML = temp; })

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!