title: Disable button if element contains class
body: <p>I want to disable my button if any of my <code>.Info</code> <code>div</code> contains <code>&lt;i&gt;</code> tag contains a specific class. I am trying to do it, but nothing works for me.</p>
  
  <p>Here is my 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>$(document).ready(function() {
    $(".Info").change(function() {
      var str = "";
      if ($("i.fa fa-times").length &gt; 0) {
        $('#jsbutton').attr('disabled', 'disabled');
      } else {
        $('#jsbutton').removeAttr('disabled');
      }
    });
  });</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;script type="text/javascript" src="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"&gt;&lt;/script&gt;
  &lt;link rel="stylesheet" type="text/css" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css"&gt;
  &lt;link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" /&gt;
  &lt;div class="info"&gt;
    &lt;i class="fa fa-times" aria-hidden="true"&gt;&lt;/i&gt;
  &lt;/div&gt;
  &lt;div class="info"&gt;
    &lt;i class="fa fa-times" aria-hidden="true"&gt;&lt;/i&gt;
  &lt;/div&gt;
  &lt;div class="info"&gt;
    &lt;i class="fa fa-times" aria-hidden="true"&gt;&lt;/i&gt;
  &lt;/div&gt;
  &lt;div class="info"&gt;
    &lt;i class="fa fa-times" aria-hidden="true"&gt;&lt;/i&gt;
  &lt;/div&gt;
  &lt;button class="btn btn-primary btn-block" type="submit" id="jsbutton"&gt;Add Purchase Order&lt;/button&gt;</code></pre>
  </div>
  </div>
  </p>