I have inputs and I want to pass the values to populated fields using jQuery. So, the new populated inputs will have different values, based on main input.
I have tried so far with below commented jquery but its not working. I'm not familiar with jQuery and Im looking for help.
$(document).ready(function () {
$(".add-more").click(function () {
//this inputs values
var mat = $('#mat').val();
var one= $('#qty').val();
//to this inputs
$('#admore').val(mat);
$('#adqty').val(one);
var html = $(".copy").html();
$(".hide").after(html);
});
$("body").on("click", ".remove", function () {
$(this).parents(".control-group").remove();
});
});
<div class="panel-body">
<form action="#">
<div class="input-group control-group after-add-more issue-from">
<input id="mat" type="text" name="addmore[]" class="form-control barcode_m" placeholder="Search or scan barcode..">
<input id="qty" type="text" name="qty[]" class="form-control barcode_qty_select" placeholder="QTY">
<div class="input-group-btn">
<button class="btn btn-success add-more" type="button"><i class="glyphicon glyphicon-plus"></i></button>
</div>
</div>
</form>
<div class="divider">
</div>
<!-- Copy Fields -->
<div class="copy hide total_sales">
<div class="control-group input-group drop_result" style="margin-top:10px">
<input id="admore" type="text" name="addmore[]" class="form-control barcode_m" placeholder="Search or scan barcode..">
<input id="adqty" type="text" name="qty[]" class="form-control barcode_qty" placeholder="QTY">
<div class="form-control barcode_price"></div>
<div class="input-group-btn">
<button class="btn btn-danger remove" type="button"><i class="glyphicon glyphicon-remove"></i></button>
</div>
</div>
</div>
</div>