L
o
a
d
i
n
g
.
.
.
https://michele.zonca.org

Adding disabled support to jquery.filestyle.js

By Michele Zonca

10 August 2010

We are using the filestyle jquery plugin to apply style to our input type=“upload” elements.

I needed to display in a properly way a disabled element, this is the diff of my small contribution:

49c51,53
<

>             if($(self).attr(“disabled”)) {
>                 $(filename.attr(“disabled”, “disabled”));
>             }
57,58c61
<                         “display”: “inline”,
<                         “cursor”: “pointer”,

>                         “display”: “inline”,   
61c64,68
<

>             if(!$(self).attr(“disabled”)) {
>                 $(self).css({
>                     “cursor”: “pointer”
>                 });
>             }

Two simple operations: I pass the attribute disabled to the “filename” variable, i.e. the input text box used as an overlay to the real upload element and i set the pointer cursor only if the original element wasn’t disabled