NYCity NYCity - 7 months ago 44
HTML Question

What is the alternative of placeholder in html for xhtml?

What is the XHTML equivalent of HTML

placeholder
.

Answer

placeholder is new in HTML 5.

There is no equivalent in XHTML 1.x (which is the XML version of HTML 4.x)

It is, of course, available in the XML serialisation of HTML 5.

Failing that, you would have to fake it using JavaScript (which is probably best done by absolutely positioning a second <label> element under the <input> which you set to have a transparent background colour unless it has a value or the focus).

Comments