HTML5 date field test (for Chrome bug)

Click into either date field. The Javascript should pup up an alert with the value of the field for that element. Because a valid date has been passed in with the value attribute, this should show "10/01/2012", but in Chrome, for the HTML-5 date field, nothing shows. Reset this value by hand, then click again, and it will now show.

by Darren Welch

HTML

<form method="post">
    <div>
        <label>HTML-5: </label>
        <input  value="2012-01-10" type="date" id="dateFieldHtml5" class='dateTest'/>
    </div>
    <div>
        <label>HTML-4: </label>
        <input  value="10/01/2012" id="dateFieldHtml4"  class='dateTest'/>
    </div>
</form>

JavaScript

$(".dateTest").click(function(e){
    e.preventDefault();
    alert("The value of this field is currently set to: " + $(this).val());
});