jQuery textbox change event

前端 未结 6 1284
孤城傲影
孤城傲影 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条回答
  •  生来不讨喜
    2020-12-09 09:45

    The HTML4 spec for the element specifies the following script events are available:

    onfocus, onblur, onselect, onchange, onclick, ondblclick, onmousedown, onmouseup, onmouseover, onmousemove, onmouseout, onkeypress, onkeydown, onkeyup

    here's an example that bind's to all these events and shows what's going on http://jsfiddle.net/pxfunc/zJ7Lf/

    I think you can filter out which events are truly relevent to your situation and detect what the text value was before and after the event to determine a change

提交回复
热议问题