jquery - Get a dynamic ID from am input field -
i trying id
of input field
has dynamic id error unrecognized expression. below code :
$("#amount_paid' + data[i].patient_visit_statement_id + '").keyup(function() { var amount_owed = $('#amount_owed' + data[i].patient_visit_statement_id + '').val(); var amount_paid = $('#amount_paid' + data[i].patient_visit_statement_id + '').val(); alert('amount owed' + amount_owed + 'amount paid' + amount_paid + ''); if (amount_owed < amount_paid) { alert('amount paid exceeds amount owed'); } });
what best way value id amount_paid has dynamic id each entry ?
should be
$("#amount_paid" + data[i].patient_visit_statement_id )
Comments
Post a Comment