+ 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

7th May 2018, 10:58 PM
love
15 Réponses
+ 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
7th May 2018, 11:41 PM
cyk
cyk - avatar
+ 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. ☺
7th May 2018, 11:46 PM
cyk
cyk - avatar
+ 2
Aaaaaah... You want the user to click on a button that will clear the field. Is that it?
7th May 2018, 11:11 PM
cyk
cyk - avatar
+ 2
「HAPPY TO HELP」 Seems we were answering the wrong question? This needs JS code
7th May 2018, 11:13 PM
cyk
cyk - avatar
+ 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
7th May 2018, 11:18 PM
cyk
cyk - avatar
7th May 2018, 11:19 PM
cyk
cyk - avatar
+ 2
Aight...thanks... Appreciate the help
8th May 2018, 12:06 AM
love
+ 1
How would that look like
7th May 2018, 11:04 PM
love
+ 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
7th May 2018, 11:08 PM
cyk
cyk - avatar
+ 1
Yes but when I do the solution disappears. The function is to convert Fahrenheit to Celsius and the clear the input
7th May 2018, 11:09 PM
love
+ 1
Then
7th May 2018, 11:09 PM
love
+ 1
I need a button to clear the input though
7th May 2018, 11:11 PM
love
+ 1
Yeah that's it
7th May 2018, 11:12 PM
love
+ 1
Yeah it's on JavaScript
7th May 2018, 11:14 PM
love
+ 1
Can it call a function that converts Fahrenheit to Celsius?
7th May 2018, 11:43 PM
love