fire the 'input' event after setting input value
This is required to support angular.js apps. If DOM elements in the browser responds to 'oninput', the angular.js framework listens for this event as a cue to update data bindings.
Showing
1 changed file
with
7 additions
and
0 deletions
... | @@ -694,10 +694,17 @@ | ... | @@ -694,10 +694,17 @@ |
694 | out = 'Unsupported field type: ' + nodeName; | 694 | out = 'Unsupported field type: ' + nodeName; |
695 | break; | 695 | break; |
696 | } | 696 | } |
697 | |||
697 | // firing the `change` event | 698 | // firing the `change` event |
698 | var changeEvent = document.createEvent("HTMLEvents"); | 699 | var changeEvent = document.createEvent("HTMLEvents"); |
699 | changeEvent.initEvent('change', true, true); | 700 | changeEvent.initEvent('change', true, true); |
700 | field.dispatchEvent(changeEvent); | 701 | field.dispatchEvent(changeEvent); |
702 | |||
703 | // firing the `input` event | ||
704 | var inputEvent = document.createEvent("HTMLEvents"); | ||
705 | inputEvent.initEvent('input', true, true); | ||
706 | field.dispatchEvent(inputEvent); | ||
707 | |||
701 | // blur the field | 708 | // blur the field |
702 | try { | 709 | try { |
703 | field.blur(); | 710 | field.blur(); | ... | ... |
-
Please register or sign in to post a comment