I have a variable that looks for input
and from this it works by getting information from it.
The problem that arises to me is that when the input is not there, the script for saying that it can not access properties of something undefined: Can not read property '0' of undefined .
How can I ignore this or simply do a check so my script does not stop ? In PHP I would do something with isset
but in JavaScript I have no idea ...
files = $(".X");
if (files[0].files.length >= 1) {
//...
}