title: jQuery Search Filter in Rails 4 Not Working
body: <p>I have a listings table and in that table there is a square_feet column. I am trying to build a filter so I can enter the low end and the high end of a square footage range and then have those results display on the page and hide the rest. This JS is being used with Rails 4. Currently, when I enter a value regardless of which field, nothing happens.</p>
  
  <p>HTML/ERB:</p>
  
  <pre><code>&lt;div class="col-sm-3"&gt;
      &lt;div class="input-group"&gt;
        &lt;input type="text" class="general-text-field listing-filter" placeholder="Min Sq Ft" id="min-square-footage"&gt;
      &lt;/div&gt;
    &lt;/div&gt;
    &lt;div class="col-sm-3"&gt;
      &lt;div class="input-group"&gt;
        &lt;input type="text" class="general-text-field listing-filter" placeholder="Max Sq Ft" id="max-square-footage"&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  </code></pre>
  
  <p>JS/jQuery:</p>
  
  <pre><code>// square footage
  var minSquareFootage = $.trim($("#min-square-footage").val()),
      maxSquareFootage = $.trim($("#max-square-footage").val());
  
  minSquareFootage = (minSquareFootage.length &gt; 0) ? parseFloat(minSquareFootage) : null;
  maxSquareFootage = (maxSquareFootage.length &gt; 0) ? parseFloat(maxSquareFootage) : null;
  
  rows.each(function(idx, elem) {
     var rowSquareFeet = $(this).data("square_feet"),
       inRange = true;
  
     if (minSquareFootage) {
       inRange = inRange &amp;&amp; (rowSquareFeet &gt;= minSquareFootage);
     }
  
     if (maxSquareFootage) {
       inRange = inRange &amp;&amp; (rowSquareFeet &lt;= maxSquareFootage);
     }
  
     console.log('rowSquareFeet: ' + rowSquareFeet, 'inRange: ' + inRange);
     console.log(elem)
  
     $(elem).toggle(inRange);
  });
  </code></pre>