Ashley P.

asked • 11/21/19

JavaScript Form Validation

4. Create the form structure shown in Figure 2, below. Write a JavaScript function according to the following requirements.

 A user should be allowed to enter his/her Fist name in a text box and select gender using drop down list.

 When a user submits information;

o emptiness of the textbox must be checked and meaningful message should be displayed considering any missing inputs.

o otherwise, a message should be displayed as follows : Message must be composed of title and first name. Title must be given according to the gender selected by the user. If gender selected as male, title should be ‘Mr.’ and id if it is selected as female, title should be ‘Ms.’

eg: If Anne was entered as name and female as gender, then an alert should be displayed as Welcome, Ms. Anne

1 Expert Answer


Patrick B. answered • 12/04/19

Math and computer tutor/teacher

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.


Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.