7👍
✅
You should consider adding this script <script src="{% static 'component/js/component.js' %}"></script>
inside the {% block jquery %}{% endblock jquery %}
That way, Django will load it after the jQuery
file
Instead of this
<script>
$(document).ready(function(){
{% block jquery %}{% endblock %}
})
</script>
Create the block that way to avoid double script
tags
<script> --> remove this script
$(document).ready(function(){
})l;
</script>
{% block jquery %}{% endblock %}
so when you call that block, you can open the script
tag
{% block jquery %}<script>< /script> {% endblock %}
or even call something from other websites
{% block jquery %}
<script src="https://cdn.something.com"></script>
<script src="{% static 'component/js/component.js' %}"></script>
{% endblock %}
Source:stackexchange.com