Monday, November 19, 2012

Making the file input to appear as a button

The file input was a bit of hectic element when it comes to styling. Even though I applied css styles the element was appeared in different ways in different browsers. Finally I came up with this solution when I was developing the HTML5 application with the use of jquery mobile css styles & javascript.

<input type = "button" value = "Choose files" onclick ="javascript:document.getElementById('file').click();">
<input type="file" name="file" id="file" style='visibility: hidden;' name="img" onchange="fileSelected();"/>

No comments:

Post a Comment