I have and two array inputs. I want them to be equal on key up event. The problem is I cannot get each 1st input value to be equal on each 2nd input.
JSFIDDLE (This fiddle only copies the first input)
Jquery I have used. (
Which only works for mgr[1] to gm[1]. but fails to copy mgr[2] to gm[2] or mgr3 to gm3
$(document).ready(function() { $("#mgr").keyup(function(){ $('#gm').val($('#mgr').val()); });});
I have also tried this jquery. But its copies 1st input value to all 2nd input SEE FIDDLE
$(document).ready(function() {
$('input[name="mgr[]"]').keyup(function(){
var val = 0;
$('input[name="mgr[]"]').each(function() {
val += Number($(this).val());
});
$('input[name="gm[]"]').each(function() {
$(this).val(val);
});
});
});
What I want

pelement, it's just doesn't look that way b/cpis a block element so they're stacked on top of each other, making it look like only the first p element is receiving the input.