From 0ada807ce6b99b95ce159a6b236309ab0ac425b3 Mon Sep 17 00:00:00 2001 From: hillai Date: Fri, 14 Nov 2014 17:09:50 +0200 Subject: [PATCH] Add modal autofocus example --- docs/_includes/js/modal.html | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/docs/_includes/js/modal.html b/docs/_includes/js/modal.html index 993b72103d..e2ed1918e1 100644 --- a/docs/_includes/js/modal.html +++ b/docs/_includes/js/modal.html @@ -15,7 +15,12 @@

There are some caveats regarding using modals on mobile devices. See our browser support docs for details.

-

Due to how HTML5 defines its semantics, the autofocus HTML attribute has no effect in Bootstrap modals.

+

Due to how HTML5 defines its semantics, the autofocus HTML attribute has no effect in Bootstrap modals. To achieve the same effect, use some custom JavaScript:

+ {% highlight js %} + $('#myModal').on('shown.bs.modal', function () { + $('#myInput').focus() + }) + {% endhighlight %}

Examples