How to set a text as a background of <input type="text">
It should not be a placeholder. But always visible.
For example:
| ‘from:’ user enters date here |
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You could always wrap your text and textfield in a div and then style the overall thing to look like a textfield.
So using this HTML:
And this styling:
Would result in this JSFiddle demo. (Tested in Chrome and FF.)
EDIT
Since the OP indicates he is looking to use the JQuery UI Date Picker, the solution would have to be slightly tweaked to allow both the label and the textfield to trigger the date picker. This is quite simple and was covered in this question.
The HTML would have to be changed to add a class name to the “wrapping” div:
<div class="extended-textfield">. This is because the date picker itself is also contained in a<div>and too generic of a CSS style causes all sorts of nasty styling collisions.The CSS selector for the div would change to
div.extended-textfield.And the JavaScript:
Working demo is here.