title: How to cancel js toggle event by condition?
body: <p>I have a button, that shows a modal window:</p>
  
  <pre><code>&lt;button class="btn btn-primary" type="button" href="modal.html" id="btn_port" data-toggle="modal" data-target="#portModal"&gt;Toggle!&lt;/button&gt;
  </code></pre>
  
  <p>and a click event for this button:</p>
  
  <pre><code>$('#btn_port').click(function(event) {
       if(not_show_modal) {
          *** not_show_modal_action ***
       }
   }
  </code></pre>
  
  <p>How to prevent modal window appearence by condition in button click event?</p>
  
  <p>and after all here is a decision:</p>
  
  <pre><code>    $('#btn_port').click(function(event) // нажатие на кнопку "Порт" для открытия модального окна
   {
  
      if($("#device_select").val()!=null)
      {
  
         $('#portModal').attr("data-remote", "portmodal.html/"+$("#device_select").val());           
         $('#portModal').modal('show');
      }
  
   });  
  </code></pre>