How To Get Values Of Each Form Javascript?
I'm getting only the first form value but the second form value not showing when I press the button this my code what i tried:
that work the solution (:
window.onload = function(){
ordersmain = document.getElementById("orders");
var leadsRef = database.ref('items-ordered');
leadsRef.on('value', function(snapshot) {
snapshot.forEach(childSnapshot => {
ordersmain.innerHTML +=`
<form >
<input list="browsers"id="${childSnapshot.val().userid}" >
<datalist id="browsers">
<option value="Order Pending">
<option value="Order Confirmed">
<option value="Order Shipped">
<option value="Order Delivered">
</datalist>
</form>
<input id="1112${childSnapshot.val().userid}" value="${childSnapshot.val().userID}">
<button id="${childSnapshot.val().userid}" onclick="reply_click(this.id)" style="padding:1px">Update</button>
</td>
</tr>
});
});
)
function reply_click(clicked_id) {
let userID = document.getElementById("1112"+''+clicked_id).value
let optionvalue = document.getElementById(clicked_id).value;
letid = clicked_id;
console.log("Oderid:"+id+"customerid"+userID+"optionvalue:"+optionvalue)
}
Post a Comment for "How To Get Values Of Each Form Javascript?"