D2L interview question

How would you write a text input HTML form with validation in Javascript?