I don't work too much in jquery and javascript so I am a little stuck on this problem. I have a long form for people to fill out and it gets added to a database and we use the information for certain reports we need. We want to add a consent form for all those under 19 years old which is just a statement that pops up and has a check box at the bottom which would say "I accept ...." and all that jazz. The date feild is just a simple field
<input type="date" name="dob" id="dob" />

I have a normal jquery drop down date picker to make it easier. I have some jquery on the page so how would I go about adding this function. I know I'd probably have to nest it under (document).ready(function() { ...}): how would I check that the field is changed, I know about the .click and all those but is there one for what I'd need and also how do I check to make sure the dob puts them younger than 19, is it something like

$('#dob').value() < ... and all that or how do I go about doing that?

$('#dob').value() < ... and all that or how do I go about doing that?

You can probably use the .blur() method. The blur() method fires when the cursor moves away from that input field. When this event triggers, you can validate the date information.

Or, just perform the validation when the submit button is clicked.

there are lots of examples online to do date/dob/age verification checking.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.