In the new version, jQuery Mobile has changed the way it works with file inputs. From the post:
Now that input file types are becoming more supported by mobile platforms, we have added an automatic style for them as part of jQuery Mobile.
And indeed, it generates HTML code around the input:
<div class="ui-input-text ui-shadow-inset ui-corner-all ui-btn-shadow ui-body-c"> <input type="file" name="files[]" multiple="" class="ui-input-text ui-body-c"> </div>
The solution would be to prevent jQuery Mobile from styling your element by simply adding the data-role="none" attribute
<input type="file" name="files[]" multiple data-role="none"/>
See jsFiddle here: http://jsfiddle.net/X23dx/1/
Update for jQuery Mobile 1.4
To get (view) a similar result with version 1.4, you need to add several new classes to the <span> environment:
<span class="ui-btn ui-icon-plus ui-btn-icon-left ui-corner-all fileinput-button"> <span>添加文件</span> <input type="file" name="files[]" multiple data-role="none"/> </span>
See updated jsFiddle: http://jsfiddle.net/X23dx/173/
source share