title: jQuery click function not working (addClass / removeClass)
body: <p>I have a hidden <strong>submit button.</strong> After the button is shown, it is supposed to change the class of two elements (using addClass and removeClass).</p>
  
  <p>But that does not work and I can't figure out why. The code seems fine to me.
  <strong>I have also tried to use toggleClass and I have the same problem.</strong></p>
  
  <p>Please help me fix this!<br>
  Thanks in advance!</p>
  
  <p>This is the code: </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>$('input[data-act="save"]').click(function(e) {
    e.preventDefault();
    var id2 = $(this).attr("data-c");
    var bkg = $('[data-sel="td ' + id2 + '"]');
    $(bkg).addClass("bg-color-fin");
    $(bkg).removeClass("bg-color");
  });</code></pre>
  <pre class="snippet-code-css lang-css prettyprint-override"><code>.bg-color {
    color: #ffffff;
    background-color: #329af0;
    text-shadow: 0 1px 0.5px #000000;
  }
  .bg-color-fin {
    color: #ffffff;
    background-color: #37b24d;
    text-shadow: 0 1px 0.5px #000000;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"&gt;&lt;/script&gt;
  &lt;table&gt;
    &lt;tr&gt;
      &lt;td data-sel="td1" class="text bg-color title2 border-bot" colspan="4"&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td data-sel="td1" colspan="4" class="text bg-color"&gt;
        &lt;div data-id="icn"&gt;
          &lt;span class="title2"&gt; I. Details&lt;/span&gt;
          &lt;span data-sel="sel1" class="r-float r-pad tiny-txt3"&gt;0/1&lt;/span&gt;
          &lt;input data-sel="sel1" data-c="1" data-act="save" class="inv r-float btn2 btn2-save btn-right" type="submit" value="Salveaza" target=""&gt;
        &lt;/div&gt;
      &lt;/td&gt;
    &lt;/tr&gt;
  &lt;/table&gt;</code></pre>
  </div>
  </div>
  </p>