Javascript boş yorum atma nasıl engellenir?

if(name.value.replace(/\s/g,"") == "" || commentText.value.replace(/\s/g,"") == ""){
alert("You must fill in all fields to comment.");
}

Bunu kullanabilirsin.
Alternatif olarak
JavaScript:
if(!name.value.trim() || !commentText.value.trim()){
  alert("You must fill in all fields to comment.");
}
 

Technopat Haberler

Geri
Yukarı