jeudi 27 février 2020

js - multiple if statements, if condition isnt met the following if statements are not checked

I have the following if statements, but if the first condition is not met the following if statements are not checked. I need them all to be checked.

document.addEventListener('DOMContentLoaded', function() {
   if(document.getElementById('firstname').value = "unsolicited"){document.getElementById('firstname').value = "";}
   if(document.getElementById('mobile').value = "unsolicited"){document.getElementById('mobile').value = "";}
   if(document.getElementById('email').value = "unsolicited@gmail.com"){document.getElementById('email').value = "";}
}, false);

Thanks so much in advance!

Aucun commentaire:

Enregistrer un commentaire