diff --git a/docs/_theme/djangodocs/layout.html b/docs/_theme/djangodocs/layout.html
index fa0b497450..6bb3653084 100644
--- a/docs/_theme/djangodocs/layout.html
+++ b/docs/_theme/djangodocs/layout.html
@@ -17,6 +17,9 @@
{%- endmacro %}
{% block extrahead %}
+{# When building htmlhelp (CHM format) disable JQuery inclusion, #}
+{# as it causes problems in compiled CHM files. #}
+{% if builder != "htmlhelp" %}
{{ super() }}
+{% endif %}
{% endblock %}
{% block document %}