jquery filestyle
Browsers do not let you style file inputs. File Style plugin fixes this problem. It enables you to use image as browse button. You can also style filename field as normal textfield using css. It is written using JavaScript and jQuery.
This plugin is inspired by work of Shaun Inman.
Want to see how it works? Check the demo page. There is also Belorussian translation of this page.
How does it work?
Plugin wraps vanilla file input with div. This div has button as background image. Image button is aligned with file inputs browse button. File input is then hidden by setting opacity to zero. Chosen file is shown in normal text input which mimics file input. This text input also inherits file inputs class. Use this class to style the text input.
How to use?
File Style depends on jQuery. Include both in your header:
<script src="jquery.js" type="text/javascript"></script> <script src="jquery.filestyle.js" type="text/javascript"></script>
You will also need button image such as one below.
Then in your code do something like:
$("input[type=file]").filestyle({ image: "choose-file.gif", imageheight : 22, imagewidth : 82, width : 250 });
Download
When asking a question please include an URL to example page where the problem occurs. If you have longer code examples please use pastie.org
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】博客园社区专享云产品让利特惠,阿里云新客6.5折上折
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步