I need to use the html5 File API to get the quantity of files selected in the input file element and set the value in another element.
HTML
<div class="form-row">
<label>Main Image</label>
<div class="form-text">None Selected</div>
<input type="file" class="txtbox" name="proImage" id="proImage" value="" />
</div>
Jquery
$('input[type=file]').change(function () {
$fileCount = $(this).files.length;
$(this).parent('.form-row').find('.form-text').html($fileCount + 'Selected');
})
Anyone know where I’m going wrong? All help appreciated
filesis not a property of jQuery object.Change this:
To:
You can also minify your selector:
http://jsfiddle.net/hHgEF/