Is there a way to add a value attribute through jQuery without removing the old attribute, similar to how addClass works? I have 7 input fields that are being typed in, and I need to combine them into one word and pass it to another input field. When I try to take the values from the typed fields and pass them to the combined field, it always takes the value from the last field.
$("input").keyup(function(){
var test = this.value;
$(".solution_2").attr('value', test);
});
Here is the HTML:
<input id="1" class="q1 inputs letter square border_black" maxlength="1" type="text"/>
<input id="2" class="q2 inputs letter square border_black" maxlength="1" type="text" />
<input class="solution_2" value="" class="form-control" type="text" name="date">
Any suggestions or ideas would be greatly appreciated. Thank you.