How do you listen / detect changes to an input value - when the input value is changed via javascript?

后端 未结 2 2017
失恋的感觉
失恋的感觉 2020-12-21 10:29

I\'ve got an input with google autoComplete connected.

When the user moves up and down through the seachResultsthe value of t

2条回答
  •  無奈伤痛
    2020-12-21 11:07

    Consider creating and triggering input events

    var event = new Event('input', {
        bubbles: true,
        cancelable: true,
    });
    

    then

    myelement.dispatchEvent(event);
    

    more info

提交回复
热议问题