Take the 2-minute tour ×

Is there an equivalent to this statement in jQuery?

var value = document.getElementById(id).files[0];

Using the standard jQuery selectors with .files[0] appended doesn't appear to work, and I can't find an equivalent jQuery command to .files. Any suggestions?

I'm using this to retrieve the file from an input type='file' form element.

share|improve this question
I am afraid there isn't for now. Please see this post. –  Hausen Zheng Jul 12 '12 at 1:34

1 Answer 1

up vote 8 down vote accepted

get(0) return DOM element

share|improve this answer
your second suggestion is right, the first one is incorrect. –  Fresheyeball Jul 12 '12 at 1:44
Thanks, I just guess :D –  Trinh Hoang Nhu Jul 12 '12 at 1:45
It just an fyi so you can refine your answer. Edit and I will upvote :) –  Fresheyeball Jul 12 '12 at 1:47
Thanks @Fresheyeball –  Trinh Hoang Nhu Jul 12 '12 at 1:50
Thanks! I totally forgot about .get(0). –  bento Jul 12 '12 at 1:53

Your Answer


