Home  >  Q&A  >  body text

javascript - Native js input automatically modifies the value of another input when one value changes

When one value of native js input changes, automatically modify the value of another input? TKS

淡淡烟草味淡淡烟草味2670 days ago1003

reply all(6)I'll reply

  • 学习ing

    学习ing2017-06-28 09:30:47

    You can use input and chagne, probably the timing of triggering is different http://jsrun.net/7UYKp

    When using input in IE, propertychange must be added to avoid incompatibility. Then there is another way is data binding. The general solution is to have an object with getter and setter methods, and then change the object when inputting, trigger the setter and then change all the associated ones.

    reply
    0
  • 某草草

    某草草2017-06-28 09:30:47

    Bind the onChange event to the input, and modify the value of another input in the onChange event

    reply
    0
  • 某草草

    某草草2017-06-28 09:30:47

    Just add dom to the onchange function. Just define it yourself for specific needs

    reply
    0
  • 代言

    代言2017-06-28 09:30:47

    Just use onchange

    reply
    0
  • 为情所困

    为情所困2017-06-28 09:30:47

    Use change event

    reply
    0
  • 曾经蜡笔没有小新

    曾经蜡笔没有小新2017-06-28 09:30:47

    $('#input1').bind('input propertychange', function() {

    $('#input2').val(this.value);  

    });

    reply
    0
  • Cancelreply