Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
446 views
in Technique[技术] by (71.8m points)

jquery - Putting placeholder attribute on file type input field

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...