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
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.
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.
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.