vendredi 27 août 2021

if with 6 getElementById not working in Javascript

This code not work with me when write 6 getElementById but work with 4 getElementById

Javascript code :

if(document.getElementById("category").value =="" ||
   document.getElementById("type").value =="" ||
   document.getElementById("item-name").value =="" ||
   document.getElementById("price-before").value =="" ||
   document.getElementById("price-after").value =="" ||
   document.getElementById("amount").value =="")
{alert("Please Input Fields")}
else
{
}

html Code :

<input type="text" class="form-control" id="item-name" placeholder="Item name" required>
<br>
<input type="number" class="form-control" id="price-before" placeholder="00" required>
<br>
<input type="number" class="form-control" id="price-after" placeholder="00" required>
<br>
<input type="number" class="form-control" id="amount" placeholder="00" min="1" required>

Aucun commentaire:

Enregistrer un commentaire