I would like to know how to implement something like stack overflow when you post a question: “At least one tag such as (css html asp.net), max 5 tags.
How can I implement something like this for a text input in html, where it is partially faded, but when you type, it doesn’t show up, and is not faded.
I don’t mind how to do this, as long as it works.
Thanks.
The easiest option is to use the
placeholderattribute:JS Fiddle demo.
If cross-compatibility is a requirement, then JavaScript is also an option:
JS Fiddle demo.
Or, with jQuery:
JS Fiddle demo.
References:
Vanilla JavaScript:
document.getElementsByTagName().element.onblur.element.onfocus.element.hasAttribute().element.getAttribute().element.style.jQuery:
:text) selector..each()..val()..css()..attr().