Call Javascript onchange event by programmatically changing textbox value

前端 未结 8 1157
心在旅途
心在旅途 2020-11-30 08:59

the problem I\'m facing is this:

  • I have a textbox for a date range along side a calendar control.
  • When the user selects a date from the calendar, it
相关标签:
8条回答
  • 2020-11-30 09:55

    You can put it in a different class and then call a function. This works when ajax refresh

    $(document).on("change", ".inputQty", function(e) {
    
    //Call a function(input,input);
    });
    
    0 讨论(0)
  • 2020-11-30 10:00

    This is an old question, and I'm not sure if it will help, but I've been able to programatically fire an event using:

    if (document.createEvent && ctrl.dispatchEvent) {
        var evt = document.createEvent("HTMLEvents");
        evt.initEvent("change", true, true);
        ctrl.dispatchEvent(evt); // for DOM-compliant browsers
    } else if (ctrl.fireEvent) {
        ctrl.fireEvent("onchange"); // for IE
    }
    
    0 讨论(0)
提交回复
热议问题