1. Home
  2. Computer Science MCQs
  3. HTML
  4. Which attribute prevents a form from being submitted while…

Added 2 Nov 2026

Which attribute prevents a form from being submitted while a field is empty?

  1. notnull
  2. mandatory
  3. validate
  4. required Correct answer

Correct answer

D. required

14 views

MCQSEXAM

Explanation

The boolean required attribute triggers the browser's built-in validation message. It works with inputs, selects and textareas.

Reference

Asked in: NTS, Web Developer Interviews

Preparing for an exam?

Doubts & discussion

Not sure why the answer is D? Ask here and get an explanation.

Ask a doubt about this MCQ

Shown after review. No links please.

More HTML MCQs

Practise all HTML MCQs

Similar MCQs