]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
Add modal autofocus example 15135/head
authorhillai <hillaib@walla.com>
Fri, 14 Nov 2014 15:09:50 +0000 (17:09 +0200)
committerhillai <hillaib@walla.com>
Sun, 16 Nov 2014 14:48:08 +0000 (16:48 +0200)
docs/_includes/js/modal.html

index 993b72103df46df1414e4555c1d57208ebf9a3be..e2ed1918e11bcd5e3d907f69b69c32e2b853d5ca 100644 (file)
     <p>There are some caveats regarding using modals on mobile devices. <a href="../getting-started/#support-fixed-position-keyboards">See our browser support docs</a> for details.</p>
   </div>
 
-  <p><strong class="text-danger">Due to how HTML5 defines its semantics, the <code>autofocus</code> HTML attribute has no effect in Bootstrap modals.</strong></p>
+  <p><strong class="text-danger">Due to how HTML5 defines its semantics, the <code>autofocus</code> HTML attribute has no effect in Bootstrap modals.</strong> To achieve the same effect, use some custom JavaScript:</p>
+  {% highlight js %}
+  $('#myModal').on('shown.bs.modal', function () {
+    $('#myInput').focus()
+  })
+  {% endhighlight %}
 
   <h2 id="modals-examples">Examples</h2>