0

I want to change the default style of input file, I searched SO and find a solution. http://jsfiddle.net/younyzhU/6v8uL2co/

<div id=customOrth style="position: absolute; left:0; top:0px; ">
<button><label for="inputFile" style="padding-left: 0px;">
<a >choose orthology File</a></label></button>
<input style="display: none;" type="file" id="inputFile">
</div>

However when I select a file, I need to change the label to the selected file name, how should I do? The default input file, will show you the choosed file name, after select a file. thanks!

Community
  • 1
  • 1
yongnan
  • 405
  • 7
  • 20

1 Answers1

0

This answer should help you, https://stackoverflow.com/a/1299069/3066711

It should be as simple as something like this.

$("#inputFile").on("change", function(data) { $("label[for=inputFile]").text($(this).val())});
Community
  • 1
  • 1
Shriike
  • 1,351
  • 9
  • 20