Its not working because because newly IMAE / S.N fields missing imae
class, you keyup function delegated by that class only.
By default you have only row and keyup works because that row has that class.
Now even you add that class while adding new row then also your keyup
will not do the changes as per you wish.
You will be entering in one row and it will update quantity in all rows
as you used class selector which will selects all Jumlah input fields
from all rows. You need to update the Jumlah filed from the same row
where keyup fired.
Your keyup will be like
- $(document).on('keyup',
'.imae', function() {
-
var imae = $(this).val();
-
if (imae!='')
- {
-
- $(this).parents('tr:first').find(".quantity").val(1);
-
$(this).parents('tr:first').find(".quantity").prop("readonly", true);
-
}
-
else
- {
-
$(this).parents('tr:first').find(".quantity").val("");
-
$(this).parents('tr:first').find(".quantity").prop("readonly", false);
- }
- })
I updated your fiddle and its working there as well, check the function
for adding more rows as well, i made changes there and added imae class
to that input filed
http://jsfiddle.net/08ps55uf/13/