title: Bootstrap modal on shown method run multiple times
body: <p>I use <a href="http://twitter.github.io/bootstrap/javascript.html#modals" rel="nofollow">twitter bootstrap modals</a>'s js to show and hide a modal:</p>
  
  <pre><code>$('#myModal').modal('show')//show
  $('#myModal').on('shown', function () {
  // do something…
  })
  $('#myModal').on('hidden', function () {
  // do something…
  })
  
  ....
  $('#myModal').modal('hide')//hide
  </code></pre>
  
  <p>My problem is when show and hide modal multiple times, the code in <code>//do something...</code> run multiple times. I guess that's because every time i show a modal, it listen to <code>shown</code> and the function run 5 times when the modal hide and open 5 times, any way to prevent this?</p>
  
  <hr>
  
  <p>Using the way <code>fco</code> suggested below did solve the shown problem, but unfortunately the hide does not work, i.e. still execute more than one times, one thing different, i hide the dialog using the <code>data-dismiss="modal"</code> markup, not through js.</p>
  
  <p>Any ideas?</p>