How can I check if all visible inputs have a value? (no jquery validator)
<p>I need to check on click of a button if all visible required fields are selected. </p>

<p>HTML:</p>

<pre><code>&lt;input type="text" class="required-entry"&gt;
&lt;input type="text" class="required-entry"&gt;
&lt;input type="text" class="required-entry"&gt;
&lt;div style="display:none"&gt;
&lt;input type="text" class="required-entry"&gt;
&lt;/div&gt;
&lt;button class="check-fields"&gt;Check Fields&lt;/button&gt;
</code></pre>

<p>Jquery:</p>

<pre><code>$('.check-fields').on('click', function () {
 var value = $('.required-entry').filter(function () {
    return this.value === '';
  });
  if (value.length == 0) {alert('Everything has a value.');
  } else if (value.length &gt; 0) {
    alert('Please fill out all required fields.');
  }
});
</code></pre>

<p><a href="https://jsfiddle.net/u0pk7cdr/3/" rel="nofollow">https://jsfiddle.net/u0pk7cdr/3/</a></p>