I have input text field and I have a placeholder inside. When I click on input, placeholder disappears. I am using jQuery Watermark plugin for this placeholders. I want to change this behavior. I need that placeholder to stay in input when user types in this field.
Nice example would be field for e-mail. In one step, user gives me domain name, for example ‘foo.com’. Placeholder for e-mail will look like ‘@foo.com’. When user clicks on this field, I want this placeholder to act like value of that input, but unchangeable. Default value of my e-mail input field is ‘@foo.com’, when user types in ‘bar’ its ‘bar@foo.com’.
I hope you understand what I am trying to do 🙂 How can I achieve this behavior?
You can just have a absolutely positioned label for this. Also, you could handle onclick and onblur events on the input in case you want to hide the label. Try this: