title: Twitter Bootstrap 2 modal form dialogs
body: <p>I have the following dialog form :</p>
  
  <pre><code>&lt;div class='modal' id='myModal'&gt;
    &lt;div class='modal-header'&gt;
      &lt;a class='close' data-dismiss='modal'&gt;×&lt;/a&gt;
      &lt;h3&gt;Add Tags&lt;/h3&gt;
    &lt;/div&gt;
  
    &lt;div class='modal-body'&gt;
      &lt;form accept-charset="UTF-8" action="/tagging" data-remote="true" method="post"&gt;&lt;div style="margin:0;padding:0;display:inline"&gt;&lt;input name="utf8" type="hidden" value="&amp;#x2713;" /&gt;&lt;input name="authenticity_token" type="hidden" value="mCNvbvoPFWhD7SoJm9FPDh+BcRvCG3d16P+oOFACPuc=" /&gt;&lt;/div&gt;
          &lt;input id="tags_string" name="tags_string" type="text" value="luca" /&gt;
          &lt;input id="id" name="id" type="hidden" value="4f1c95fd1d41c80ff200067f" /&gt;
      &lt;/form&gt;
    &lt;/div&gt;
  
    &lt;div class='modal-footer'&gt;
      &lt;div class='btn btn-primary'&gt;&lt;input name="commit" type="submit" value="Add tag" /&gt;&lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>and his JS :</p>
  
  <pre><code>&lt;script&gt;
    //&lt;![CDATA[
      $(function() {
        // wire up the buttons to dismiss the modal when shown
        $("#myModal").bind("show", function() {
          $("#myModal a.btn").click(function(e) {
            // do something based on which button was clicked
            // we just log the contents of the link element for demo purposes
            console.log("button pressed: "+$(this).html());
            // hide the dialog box
            $("#myModal").modal('hide');
          });
        });
        // remove the event listeners when the dialog is hidden
        $("#myModal").bind("hide", function() {
            // remove event listeners on the buttons
            $("#myModal a.btn").unbind();
        });
        // finally, wire up the actual modal functionality and show the dialog
        $("#myModal").modal({
          "backdrop" : "static",
          "keyboard" : true,
          "show" : true // this parameter ensures the modal is shown immediately
        });
      });
    //]]&gt;
  &lt;/script&gt;
  </code></pre>
  
  <p>When I click x, which is <code>&lt;a class='close' data-dismiss='modal'&gt;×&lt;/a&gt;</code>, the form close down leaving me on the current page, while I'd like to go on the hamepage. </p>
  
  <p>Also "Add tag" botton, which is <code>&lt;div class='btn btn-primary'&gt;&lt;input name="commit" type="submit" value="Add tag" /&gt;&lt;/div&gt;</code> don't do nothing, while clicking jaust ENTER on the keyboard do the job and I'd like clicking "Add tag" did the same.</p>
  
  <p>I'm not so skilled on JS and front-end prog, so any help is welcome.</p>