Mar 7, 2011

Custom input file field jQuery

Now you can style a file field using jquery, which was quite impossible in HTML and CSS2.

Just call .file() on an element and it creates an transparent overlay containing a classic file input so you can select files by clicking your element. All mouse events are redirected to original element so it doesn't break custom buttons :).

Triggers the event choose when a file has been chosen. Also supports the new html5 multiple attribute. Usage examble below:

$('#my-element').file().choose(function(e, input) {
   alert(input.val()); //alerts the chosen filename. 
});
To upload the chosen file to a server you should then attach the input element to a form element


VIEW DEMO
DOWNLOAD

No comments:

Post a Comment

Test post after a long time

i want to see the post