I’m trying to produce the same value (for now) when I input something in one text I want it to show up in the other text box, but right now it’s showing one less value… this is the present code

		 var value1 = $(this).val();	 

This is what it produces, one less digit,

then when I start to remove texts it the second text box doesn’t adjust values accordingly. It remains what it was.

if keypress() is not a good option to serve this purpose, please let me know what would be… Thanks for reading and help.

okay I think keyup() is the solution for now.

I also changed


the first one adds value to the value attribute but don’t know where the value gets preserved for the second one.


From the screenshot, it looks like your trying to sync inputs of the type=“number”.

If so, this should work:

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>Sync input</title>
    <input id="one" type="number" />
    <input id="two" type="number" />
    <script src="" type="text/javascript"></script>
      function syncBox(){
        keyup: syncBox,
        change: syncBox

You have to respond to the change event for when you click the arrows to increase and decrease the value.
You have to respond to the keyup event for when someone is typing in the box.


1 Like