Don't try to listen to selector events if selector doesn't exist

This commit is contained in:
Gabriel Augendre 2018-06-02 09:52:04 +02:00
parent f21f8a8ac9
commit 2016948119

View file

@ -1,5 +1,6 @@
document.addEventListener("DOMContentLoaded", function (event) {
var _selector = document.querySelector('#id_no_book');
if (_selector === null) return;
_selector.addEventListener('change', function (event) {
if (_selector.checked) {
document.querySelector('#id_title').value = "PAS DE LIVRE POUR CETTE CLASSE";