jQuery textbox change event

前端 未结 6 1263
孤城傲影
孤城傲影 2020-12-09 09:29

Does text input element not have a change event? When I attach a change event handler to a text input it is not being fired. Keyup is fired, but keyup is not sufficient for

6条回答
  •  萌比男神i
    2020-12-09 09:48

    There is no real solution to this - even in the links to other questions given above. In the end I have decided to use setTimeout and call a method that checks every second! Not an ideal solution, but a solution that works and code I am calling is simple enough to not have an effect on performance by being called all the time.

    function InitPageControls() {
            CheckIfChanged();
        }
    
        function CheckIfChanged() {
            // do logic
    
            setTimeout(function () {
                CheckIfChanged();
            }, 1000);
        }
    

    Hope this helps someone in the future as it seems there is no surefire way of acheiving this using event handlers...

提交回复
热议问题