0

Need help with my simple html and js code

How to make the function add kilograms only once without changing onInput event attribute https://code.sololearn.com/WYiHENYpQ48I/?ref=app

14th Nov 2018, 9:36 AM
<noob>eric</noob>
<noob>eric</noob> - avatar
3 Answers
+ 1
You could also cheat by removing input's style and wrap your value + " kilogram(s)" inside a div which looks like an input.
14th Nov 2018, 10:18 AM
Geoffrey L
Geoffrey L - avatar
0
Remove </input> in your HTML. And change this line : document.getElementById("svalue").value = x+" kilogram(s)"; to document.getElementById("svalue").value = x; If you still want to display " kilogram(s)", use HTML outside of your input field.
14th Nov 2018, 9:46 AM
Geoffrey L
Geoffrey L - avatar
0
I want the kilogram inside the text area just like the result box. It actually can be done just by changing onInput with onBlur. But now I need to click somewhere else for the result to show up.
14th Nov 2018, 10:06 AM
<noob>eric</noob>
<noob>eric</noob> - avatar