CodeCloudy

Azure | .Net | JQuery | Javascript | Umbraco

Capture Dynamic value change in Elements using on change

 

$(‘#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 comment »