This question might seem elementary to some but I can't get my head around it. I am working on a XMLHttpRequest Ajax file upload. the first step is to selected the fileUpload element that is on my page and for some reason javascript works but not query, here's the following two lines:
var fileInput = $('#the-file'); //doesn't work var fileInput = document.getElementById('the-file'); //works do I have to specify a method after the jquery selector or sth? Because I can't see why else it wouldn't work, aren't they practically the same code?
I have added the jquery.js file on top (I have many lines of jquery working on other parts of my file so that can't be the issue.) and the document ready. I got it to work but am wondering the reason behind this.
Edit
By doesn't work I mean that with the jquery selector I get "undefined" in console log but with the javascript I get all the file information that I need.
fileInput[0].files[0]for the jQuery version?