title: Bootstrap - how to make modal not showing if the condition is false when clicking the button
body: <p>In my web project i am using bootstrap. Everything goes smoothly except one case below:</p>
  
  <p>In one page there is a button. when its clicked a JS function will be invoked to do some checking. If the checking fails, i hope only the alert message box shows up. However both the alert box and modal Div box show. Can someone help? Thanks a lot!</p>
  
  <p>Below is the code i am using:</p>
  
  <p><strong>button:</strong></p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;button id="setPropertiesDivButton" type="button" class="btn btn-default"
  data-toggle="modal" data-target="#setPropertiesDiv"
  onclick='showSetPropertiesDiv(-1)'&gt;Add Properties&lt;/button&gt;
  </code></pre>
  
  <p><strong>Modal Div:</strong></p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;div class="modal fade" id="setPropertiesDiv"&gt;
  ........
  &lt;/div&gt;
  </code></pre>
  
  <p><strong>JS function:</strong></p>
  
  <pre class="lang-js prettyprint-override"><code>function showSetPropertiesDiv(pageIndex) {
      if (!checkObjIsNull($("#oldPrice"))) {
          top.dialog_alert("Please set Price!");
          $("#setPropertiesDiv .modal-dialog .modal-content .modal-footer .btn.btn-primary").hide();
          //$('#setPropertiesDiv').modal('hide');
          //$("#setPropertiesDiv .modal-dialog .modal-content .modal-footer .btn.btn-primary").modal('hide');
          return false;
      }
  }
  </code></pre>