CodeCloudy

Azure | .Net | JQuery | Javascript | Umbraco

Capture Dynamic value change in Elements using on change

on November 1, 2017

 

$(‘#abc2’).on(‘change’, function(){
$(‘#abc1’).val($(this).val())
})

$(‘#abc1’).on(‘change’, function(){
alert(‘1’)
})

var originalVal = $.fn.val;
$.fn.val = function(){
var result =originalVal.apply(this,arguments);
if(arguments.length>0)
$(this).change(); // OR with custom event $(this).trigger(‘value-changed’);
return result;
};

 

http://jsfiddle.net/aw1htjzo/

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: