Combining Age and Date of Birth in Web Applications Using Age Picker
Imagine for a moment you’re an insurance agent selling a product to a client. You’re working with an web application that requires the client’s age. You ask the client. They reply with their date of birth. But, the field specifically asks for numeric age.
You have a few options:
- Do the math (uggggh)
- Ask the client for their age instead (…you couldn’t just figure it out?)
- Use Age Picker in your web applications!
data- attribute used.
Wiring it up
Age Picker is wired up by decorating an
input tag with an
It can be as simple as:
<label for="age">Age or DOB</label> <input type="text" id="age" name="age" data-age-picker />
// With age-picker available: new AgePicker().init();
Age Picker is MIT licensed and available on GitHub. It’s age-picker on the npm registry.