I have 3 input boxes in my page.
What I need to do is Onchange add the values of Input box A and Input Box B with a comma separating the two values.
For example:
Input A = 'MyValueA'
Input B = 'MyValueB'
Result = 'MyValueA , MyValueB'
This will allow infinite textboxes
HTML
<input class="valuegroup" id="inputa" />
<input class="valuegroup" id="inputb" />
<input class="output" id="inputz" />
JS
$(function() {
$('.valuegroup').on('change keyup', function() {
var myVal, newVal = $.makeArray($('.valuegroup').map(function(){
if (myVal = $(this).val()) {
return(myVal);
}
})).join(', ');
$('.output').val(newVal);
});
});