Home  >  Q&A  >  body text

javascript - easyui textbox binding onchange event cannot get the latest text box value

<input id="id1" class="easyui-textbox" onchange="fun()">
function fun() {
    alert($("#id1").textbox("getText"));
}

The input value is not obtained after the input value in the input box loses focus

怪我咯怪我咯2664 days ago1446

reply all(1)I'll reply

  • 迷茫

    迷茫2017-07-05 10:44:53

    The change monitoring event of

    EasyUI is not written directly in the onchange event of input. The onclick event of input only monitors the operation of HTML itself, which may not be effective for EasyUI binding. The correct approach is to When binding the EasyUI control, write it in the control configuration:

    $('#id1').textbox({  
        onChange: function(value) {
            alert($("#id1").textbox("getValue"));
        }
    });

    reply
    0
  • Cancelreply