IDs must be
unique
within the document. Change
cant_prod
to a
class
to allow it to be repeated.
There's no need to traverse the DOM to get the input value:
- var
cantProd = $(this).closest('.prueba2').find('#cant_prod').val();
Just use this - the input for which the keypress happened:
- var
cantProd = $(this).val();