title: Bootstrap Modal open on condition
body: <p>I'm using Bootstrap modal popup to show content in popup and I'm using if/else condition to open modal popup. I don't want to open modal popup when condition is false. My code:</p>
  
  <pre><code>&lt;a data-toggle="modal" class="btn btn-primary" style="font-size: 10px" href="#" data-target="#myModal" title="Edit"&gt;&lt;span class="glyphicon glyphicon-pencil"&gt;&lt;/span&gt;Edit&lt;/a&gt;
  </code></pre>
  
  <p>My jQuery is:</p>
  
  <pre><code> $('a[data-target=#myModal]').on('click', function (ev) {
          ev.preventDefault();
          if (filters.length &lt;= 0) {
              alert('Please select any one item in grid');
          }
          else {
              $(this).attr('href', '/GeoRegion/Edit/' + filters[0]);
              var target = $(this).attr("href");
  
              // load the url and show modal on success
              $("#myModal").load(target, function () {
                  $("#myModal").modal("show");
              });
          }
      });
  </code></pre>
  
  <p>If filters.length&lt;=0 then I don't want to open popup. Now popup opening with empty content.</p>