my task is to store user multiple input values in javascript array using push method
the code is
<body>
<h3>employee form</h3>
<div class="row">
<div class="col-md-6">
<form>
<label for="id">Id</label>
<input type="number" id="i1"/></br>
<label>Name:</label>
<input type="Name" id="name"></br>
<label for="qty">Qty:</label>
<input type="Qty" id="qty"/></br>
<label for="price">price:</label>
<input type="price" id="price"/></br>
<button onclick="pushData();">ADD</button>
</div>
<div class="col-md-6" id="display">
</div>
</div>
</form>
<script>
var myArr = [""];
i tried but i didnt get exact output freinds please give some tips are codes friends
3
Answers
Try this..
All the inserted values are being stored in a main array
final_array
.Here’s the working JSfiddle for the same
I made this in Jquery instead of JS cause its easy to work with.
Let me know if you came across any trouble.
Without any specific output format, this is how to get and push inputs value into array and displaying in order.
You can try this one it just push multiple products into array in display div