hasnat
hasnat

Reputation: 1

How to multiply a number that has been enter in the form of html and display with a number while using html

when we enter the number in the form of html it will automatically multiply by 20. how to show the the answer on next field while using html?

Upvotes: 0

Views: 457

Answers (2)

user3175112
user3175112

Reputation: 151

Add an event listener.

<form>
<input type="text" id="t1" oninput="getElementById('t2').value = this.value * 20">
<input type="text" id="t2">
</form>

Upvotes: 1

Dave
Dave

Reputation: 29121

HTML is a markup language (used for structuring/organizing your data), not a programming language (used for calculations...etc). For calculations, you'll likely want to utilize JavaScript to retrieve the values from the HTML fields, do some calculations, then write the value to the next field. There are other options, but that's probably the best place to start.

Upvotes: 2

Related Questions