title: jQuery: Reset classes once the field is empty
body: <p><strong>NOTE:</strong>
  The following solution comes from <a href="https://stackoverflow.com/questions/30024768/jquery-select-identical-numbers-from-a-table">THIS TOPIC</a>, please see that first.</p>
  
  <p>I have 11 inputs:</p>
  
  <pre><code>&lt;input type="text" class="[something]-input inputs"&gt;
  </code></pre>
  
  <p>(Where <code>[something]</code> is a name, different for every input)</p>
  
  <pre><code>$(document).on("change", ".inputs", function(){
      var thisclass = $(this).attr('class').split("-")[0];
      if($(this).val() == ''){
          //
      }
      highlightInputNumbers(thisclass, 0);
  
  });
  </code></pre>
  
  <p>The <code>highlightInputNumbers</code> function goes this way:</p>
  
  <pre><code>function highlightInputNumbers(classe, stepcount, empty){
  
          var all= $("td[class*="+classe+"]");
          var index = all.length-1;
          var concat_steps = $(all[index]).html().split('.')
  
          //var due_serie = $(all[index]).html().split('.')
  
          var due_serie = $('.'+classe+'-input').val().split('.')
  
          for (var i = index; i &gt;= (index-stepcount)+2; i--) {
              due_serie = due_serie.concat($(all[i-1]).html().split('.'));
          };
  
          //Rimuovo i doppioni
          var serieCompleta = [];
          $.each(due_serie, function(i, el){
              if($.inArray(el, serieCompleta) === -1) serieCompleta.push(el);
          });
  
          //Ottengo dati          
  
          for(var s = 0; s &lt; index-(stepcount-1); s++){
  
              var bar = $(all[s]);
              var barnum = bar.html().split('.');
              bar.html('');
  
              var found = 0;
  
              for(i = 0; i&lt;= barnum.length-1; i++){
  
                 for(n = 0; n&lt;= serieCompleta.length-1; n++){
  
                    if(i != 4){ var punto = '.' }else{ var punto = ''}
  
                        /* Problem here:*/
                        if(barnum[i] == serieCompleta[n]){
                          bar.append('&lt;span class="highlight"&gt;'+barnum[i]+'&lt;/span&gt;&lt;span class="fade"&gt;'+punto+'&lt;/span&gt;');
                          found = barnum[i];
                        }
                   }
  
                 if(barnum[i] != found){
                  bar.append('&lt;span class="fade"&gt;'+barnum[i]+punto+'&lt;/span&gt;');
                 }
               }
  
            }
        }
  </code></pre>
  
  <p>Where I commented <code>/*Problem here*/</code> is where I highlight the numbers in the column (that I have inserted), but if I remove the numbers in the input they stay highlighted... If I change them it keeps the old ones..</p>
  
  <p>As you can see here: <a href="https://dl.dropboxusercontent.com/u/2276958/Cols_and_rows.mov" rel="nofollow noreferrer">https://dl.dropboxusercontent.com/u/2276958/Cols_and_rows.mov</a></p>