Detect if input type = "date" supports placeholder

Is it possible to determine if the browser supports input type="date"using placeholder?

+5
source share
1 answer

The W3 validator says that placeholder attributes are not valid for date entries. Checking this HTML:

<!doctype html>
<title>date placeholder test</title>
<input type="date"  placeholder="enter a date">

Gives an error: " Attribute placeholder not allowed on element input at this point." ... and says that you can use the attribute " placeholder when type is text, search, url, tel, e-mail, password, or number".

In addition, Chrome does not show a placeholder for entering the date, although it believes that this attribute exists in JS (this is about how Modernizr checks the attributes):

var test = document.createElement(element);
test.type = 'date';
alert('placeholder' in test);
+7
source

All Articles