Skip to content

Commit 6c72b35

Browse files
committed
Avoid Javascript error
search.js / search_template.js uses jquery for running JS when the document is ready, but cannot use jQuery for that, because jQuery is lazily loaded, and thus might not be available yet (#117)
1 parent f451b09 commit 6c72b35

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

template/search_template.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
$(function(){
1+
// cannot use $(...) here, because jQuery is loaded asynchronously,
2+
// and might not be available yet.
3+
document.addEventListener("DOMContentLoaded", function(event) {
24
$('#search').css('visibility', 'visible');
35
$("#query").autocomplete({
46
position: { my: "right top", at: "right bottom", of: "#search div" },

0 commit comments

Comments
 (0)