I have the following HTML markup:
<div>
<a>browse<input type="file" name="annex"></a>
<span class="filename"></span>
</div>
I am using this markup to style the file input with CSS.
I would like to show the file name (filename.ext) in the span with class "filename".
I tried the following with JQuery:
$('.file').on('file', function (event, files, label) {
$('.path').html($(this).val().replace(/\\/g, '/').replace(/.*\//, ''));
alert($(this).val());
});
The span is still empty and the alert result is also empty.
How can I do this?
Thank You, Miguel