Reputation: 75
I am trying to grab the file size, of a selected file, before a user submits the form. I am trying to use JQuery to do this so that I can prevent form submission if the file size is too big. But I can't get my code to work right.
My Jquery on form submit:
var size = $("photo-input")[0].files[0].size;
What could I be doing wrong?
Upvotes: 0
Views: 37
Reputation: 133453
You should prefix #
, assuming you want to select on the basis of ID
var size = $("#photo-input")[0].files[0].size;
HTML has no element as photo-input
Upvotes: 1