HTML and CSS Reference
In-Depth Information
<p><button type="submit">Submit</button></p>
</form>
Write a script to detect support for date and, if it is not available, trigger jQuery UI's
date-picker widget:
<script>
if (!Modernizr.inputtypes.datetime) {
$("#dob").datepicker();
}
</script>
I bet you're surprised at how little code is needed for this example, as compared to the
previous one! This is the beauty of adopting a reusable solution, like jQuery UI.
Figure 3-28 shows the result for a browser that does not natively support the date input
type.
Figure 3-28. The jQuery UI date picker is triggered since Firefox 4 does not support the date and time
input types
As in the previous example, this script can appear immediately after the form, or it can
be combined with other scripts at the bottom of the body of your document.
 
Search WWH ::




Custom Search