Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 23074d7

Browse files
committed
Add this.blur() to manual AJAX example
Because the modal cannot infer the anchor that triggered the open, we must explicitly blur it. Otherwise the link remain focused and the modal will be re-triggered each time the `return` key is hit.
1 parent 640c28f commit 23074d7

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

‎examples/index.html‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,7 @@ <h2 id="example-4"><a href="#example-4">#</a> Example 4: AJAX</h2>
274274
<pre><code>// Open modal in AJAX callback
275275
$('#manual-ajax').click(function(event) {
276276
event.preventDefault();
277+
this.blur(); // Manually remove focus from clicked link.
277278
$.get(this.href, function(html) {
278279
$(html).appendTo('body').modal();
279280
});
@@ -494,6 +495,7 @@ <h2 id="example-8"><a href="#example-8">#</a> Example 8: Custom Class for Close
494495

495496
$('#manual-ajax').click(function(event) {
496497
event.preventDefault();
498+
this.blur();
497499
$.get(this.href, function(html) {
498500
$(html).appendTo('body').modal();
499501
});

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /