title: bootstrap modal on load page issue
body: <p>I have a bootstrap modal on load page it works properly but I want to add class to an element if it active and remove it if it not active I tried the following but it doesn't work properly!
  <a href="https://codepen.io/kemozzz/pen/gvoqRx" rel="nofollow noreferrer">here is the example</a></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>$(window).load(function() {
    $("#myModal").modal("show");
  });
  if ($("#myModal").hasClass("in")) {
    $(".test").addClass("active");
  } else {
    $(".test").removeClass("active");
  }</code></pre>
  <pre class="snippet-code-css lang-css prettyprint-override"><code>.test {
    width: 100px;
    height: 100px;
    background-color:#e0e0e0;
  }
  .active {
    background-color:#000;
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>  &lt;link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"&gt;
    &lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"&gt;&lt;/script&gt;
    &lt;script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"&gt;&lt;/script&gt;
  &lt;div id="myModal" class="modal fade" role="dialog"&gt;
    &lt;div class="modal-dialog"&gt;
      &lt;!-- Modal content--&gt;
      &lt;div class="modal-content"&gt;
        &lt;div class="modal-header"&gt;
          &lt;button type="button" class="close" data-dismiss="modal"&gt;&amp;times;&lt;/button&gt;
          &lt;h4 class="modal-title"&gt;Modal Header&lt;/h4&gt;
        &lt;/div&gt;
        &lt;div class="modal-body"&gt;
          &lt;p&gt;Some text in the modal.&lt;/p&gt;
        &lt;/div&gt;
        &lt;div class="modal-footer"&gt;
          &lt;button type="button" class="btn btn-default" data-dismiss="modal"&gt;Close&lt;/button&gt;
        &lt;/div&gt;
      &lt;/div&gt;
  
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="test"&gt;&lt;/div&gt;</code></pre>
  </div>
  </div>
  </p>