Reputation: 3681
I need to manually make call to .change()
to do some operation and i have written an .on()
for this functionality for other input
controls. But for DatePicker
column i need to fire it manually as it's not firing whenever date is set to textbox.
$('input.JDateCtrl').datepicker({
onSelect: function (dateText) {
debugger;
//$(this).parent().find('input[type=text]').val(dateText);
$(this).parent().find('input[type=text]').attr('value', dateText);
var ctrlID = $(this).parent().find('input[type=text]').attr('id');
$('#' + ctrlID).trigger('change');
// $('#' + ctrlID).change(); // Tried it too
}
});
And .on()
is as below.
$jQuery(document).on('change', '.JAsyncUpdateTxt', function () {
// Some Operations being performed in this block
});
But .on()
is not firing whenever i make trigger change
event.
P.S : its already wrapped inside $jQuery(document).ready();
Upvotes: 0
Views: 711
Reputation: 553
Please put your .on() first then .datepicker as below:-
$(document).on('change', '.JAsyncUpdateTxt', function () {
// Some Operations being performed in this block
});
$('input.JDateCtrl').datepicker({
onSelect: function (dateText) {
debugger;
//$(this).parent().find('input[type=text]').val(dateText);
$(this).parent().find('input[type=text]').attr('value', dateText);
var ctrlID = $(this).parent().find('input[type=text]').attr('id');
$('#' + ctrlID).trigger('change');
// $('#' + ctrlID).change(); // Tried it too
}
});
I think this can help you.
Upvotes: 1
Reputation: 431
$(document).on('change', '.JAsyncUpdateTxt', function () {
// Some Operations being performed in this block
});
remove jquery use one either jquery or $
Upvotes: 0
Reputation: 5211
$(document).on('change', '.JAsyncUpdateTxt', function () {
// Some Operations being performed in this block
});
Remove 'jQuery'. Use any one.
Upvotes: 6