javascript - Jquery Detect Change when Updated by JQuery -


i know might appear paradoxical i'm trying work out how detect change on text input when value updated jquery.

during user using page javascript this:

$('#licenseownerid').val(company.id); 

what want react value being set , execute function.

so far i've tried following methods:

var obj = document.getelementbyid('licenseownerid'); obj.onchange = function () {     alert('select changed!'); }; 

and i've tried this:

$('#licenseownerid').bind('change input propertychange', function(event) {     alert('select changed!'); }); 

and i've tried this:

$('#licenseownerid').change(function () {     alert('select changed!'); }); 

none of these seem fired when value updated , cannot think of other methods try , hook up. correct way (if any) wire up?

i'm starting wonder if possible , consequently cross browser safe.

it's easy this:

$('#licenseownerid').val(company.id).trigger('change'); 

using

$('#licenseownerid').change(function () {     alert('select changed!'); }); 

there no other way (without modifying jquery core methods), have trigger event yourself.


Comments

Popular posts from this blog

html - Sizing a high-res image (~8MB) to display entirely in a small div (circular, diameter 100px) -

java - IntelliJ - No such instance method -

identifier - Is it possible for an html5 document to have two ids? -