Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Putting placeholder attribute on file type input field

Tags:

html

jquery

Is there a way to put a placeholder for input field which are file type?

I already tried jquery watermark plugin and it doesn't work.

like image 907
MegaNairda Avatar asked Jul 27 '12 10:07

MegaNairda


People also ask

How do you insert a placeholder field?

The placeholder attribute specifies a short hint that describes the expected value of an input field (e.g. a sample value or a short description of the expected format). The short hint is displayed in the input field before the user enters a value.

How do I add a placeholder to a field in HTML?

So putting placeholders in forms in HTML is very simple. You just use the attribute, placeholder and set it equal in single or double quotes to the value that you want it to be.

Should input fields have placeholder text?

The placeholder text is useless and shouldn't be there. Repeating the label will also clutter your textfields and make users think they entered input already when they haven't. This often occurs when users skip fields and go back to review them.

How do you select a placeholder of input?

The ::placeholder selector selects form elements with placeholder text, and let you style the placeholder text. The placeholder text is set with the placeholder attribute, which specifies a hint that describes the expected value of an input field.


1 Answers

Placeholder attribute should not be used for <input type="file">. Placeholders are used to give a hint about the input. And as file input is itself a browse button, it is clearly seen that it is for choosing a file. And if there's no file chosen it shows "no file chosen" next to the button.

Because:

  1. In some browsers it just shows up as a button.
  2. It already have default text which can not be changed.
  3. Each browser renders it in own way.
  4. IE will not support placeholder text.
like image 200
AlphaMale Avatar answered Dec 02 '22 19:12

AlphaMale