+ 3
Clear Input Button
How do I clear the input of my form After calling on a function to perform a calculation based on the users input
15 Respuestas
+ 4
Here love. You've got your answer. Played around with one of the codes I posted earlier
https://code.sololearn.com/Ws19kJz1Bc72/?ref=app
+ 3
I didn't code it to do that. I only solved your "clear input field on button click issue"... The rest doesn't have much to do with JS per say, it is a function that gets the value of the input field and does a conversion and returns it. Give it a try and we will help if you get stuck. ☺
+ 2
Aaaaaah... You want the user to click on a button that will clear the field. Is that it?
+ 2
「HAPPY TO HELP」 Seems we were answering the wrong question? This needs JS code
+ 2
「HAPPY TO HELP」 love Nah. JS. Event handler for the clear button. We could also do in the button stuff in HTML, onclick="this.form.reset();". But the button will have to be with the input fields between form tags
+ 2
「HAPPY TO HELP」 Sure!...
+ 2
Aight...thanks... Appreciate the help
+ 1
How would that look like
+ 1
Here. Look at line 15 of the first code, the part that has to do with onfocus and line 16 of the second code, the part that has to do with onfocus. They both do what you want, kind of. Basically when the user clicks in the input field it is cleared and ready to receive new inputs
https://code.sololearn.com/Wte6t2yXQMvF/?ref=app
https://code.sololearn.com/WAMXplm993Bk/?ref=app
+ 1
Yes but when I do the solution disappears. The function is to convert Fahrenheit to Celsius and the clear the input
+ 1
Then
+ 1
I need a button to clear the input though
+ 1
Yeah that's it
+ 1
Yeah it's on JavaScript
+ 1
Can it call a function that converts Fahrenheit to Celsius?