Check if value is null
<pre><code>var isempty = 0;
collegeArray = $(form).find(".cname").serializeArray();
for (var i = 0; i &lt; collegeArray.length; i++) {
    alert(collegeArray[i].value);
    if (collegeArray[i].value = "") {
        isempty = isempty + 1;
    }
}

if (isempty == 0) {
    container.innerHTML = "";
    document.getElementById('survey').style.visibility = 'visible';
    generateSurvey(collegeArray);
} else {
    alert("Please fill out all fields!");
}
</code></pre>

<p>I'm trying to check if a set of fields, has at least one empty field. If there is empty field and alert should pop, if not it should do something else. I'm serializing the input fields as an array and then looping through it. When I run it, it seems that it's alway thinking that there are no empty fields even if there are some. How do I fix this? </p>
