Silver Challenge: Custom Validation for Decaf

Add another function to your Validation module. It should accept two arguments: a string and an integer. If the string contains the word “decaf” and the integer is greater than 20, the function should return false.

Add listeners for the coffee order text field and for the caffeine strength slider. Trigger the custom validation for whichever field is currently being edited and caused the validation failure.

Get Front-End Web Development: The Big Nerd Ranch Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.