I have this code in the base.html template
[code]
<script>
{% block script %}{% endblock %}
</script>
and this code in the welcome.html template which extends the base.html template
[code]
<script>
{% block script %}
function toggleDropdown (){
document.getElementById(‘dropdown-id’).classList.toggle(‘display’);
}
{% endblock %}
</script>
The toggleDropdown doesn’t produce any display. But only works with this refactoring in the welcome.html
[code]
<script>
{% block script %}
function toggleDropdown (){
document.getElementById(“dropdown-id”).classList.toggle(“display”);
}
{% endblock %}
</script>
Notice that the only changes made are with the
[code] document.getElementById(‘dropdown-id’).classList.toggle(‘display’);
to
[code] document.getElementById(“dropdown-id”).classList.toggle(“display”);
i.e from ‘…’ to “…” . I still don’t understand why it happens that way .