Skip to content

Commit 0a8299f

Browse files
ycerutojaviereguiluz
authored andcommitted
avoids a DOM query for 'body' and avoids the need to wait for DOM ready
1 parent db98a4e commit 0a8299f

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

app/Resources/views/base.html.twig

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -154,15 +154,15 @@
154154
<script>
155155
$(document).ready(function() {
156156
hljs.initHighlightingOnLoad();
157+
});
157158
158-
$('body').on('submit', 'form[data-confirmation-message]', function (event) {
159-
var message = $(this).data('confirmation-message');
159+
$(document).on('submit', 'form[data-confirmation-message]', function (event) {
160+
var message = $(this).data('confirmation-message');
160161
161-
if (confirm(message) === false) {
162-
//cancel the event
163-
event.preventDefault();
164-
}
165-
});
162+
if (confirm(message) === false) {
163+
//cancel the event
164+
event.preventDefault();
165+
}
166166
});
167167
</script>
168168
{% endblock %}

0 commit comments

Comments
 (0)