I want to calculate new value upon keypress in a textbox inside a datatable. However, the textbox inside the datatable is not triggering upon keypress.
$(document).on('mouseover', '#table1 tr', function() {
rndex = this;
jindex = this.rowIndex;
});
var dtable = $('#table1').DataTable();
var origval = $('#table1 tr:eq(' + parseInt(rndex) + ') >td:eq(' + 1 + ')').html();
var $textvalue = $(jindex).find(".txtBox");
var newval;
$textvalue.on('keypress', function(e) {
if (e.which != 8 && e.which != 0 && (e.which < 48 || e.which > 57)) {
e.stopImmediatePropagation();
return false;
}
}).on('keyup change', function(e) {
newval = parseFloat(origval) + this.value;
alert(origval);
});
Thank you in advance!