<input type="file" value="Browse" name="avatar" id="id_avatar" />
I tried to modify the value
, but it's not working. How to customize the button text?
<input type="file" value="Browse" name="avatar" id="id_avatar" />
I tried to modify the value
, but it's not working. How to customize the button text?
<input type="file">
, add an image and<input style="position:absolute">
it will occupy the space of<input type="file">
Use the following CSS to the file element
The "upload file..." text is pre-defined by the browser and can't be changed. The only way to get around this is to use a Flash- or Java-based upload component like swfupload.
This is a JQuery plugin to change the button text of an input file element.
Example HTML:
Example JS:
Result:
Use
<label>
for the captionThis works without any javascript. You can decorate the label to any degree of complexity, to your heart's content. When you click on the label, the click automatically gets redirected to the file input. The file input itself can be made invisible by any method. If you want the label to appear like a button, there are many solutions, e.g.:
This is an alternative solution that may be of help to you. This hides the text that appears out of the button, mixing it with the background-color of the div. Then you can give the div a title you like.
Hide the file input. Create a new input to capture a click event and forward it to the hidden input: