Quand on n'a pas de fileInput, on ne charge pas le js correspondant

This commit is contained in:
Tom Hubrecht 2021-05-26 20:54:22 +02:00
parent 3af0ab9971
commit c1bc5c1d05

View file

@ -4,7 +4,8 @@
{% block extra_head %} {% block extra_head %}
<script> <script>
$(document).ready(function($) { {% if not election.sent_mail %}
document.addEventListener('DOMContentLoaded', () => {
const fileInput = document.querySelector('#import-voters input[type=file]'); const fileInput = document.querySelector('#import-voters input[type=file]');
fileInput.onchange = () => { fileInput.onchange = () => {
if (fileInput.files.length > 0) { if (fileInput.files.length > 0) {
@ -13,6 +14,7 @@
} }
}; };
}); });
{% endif %}
</script> </script>
{% endblock %} {% endblock %}