Making 'file' input element mandatory (required)

css, html

Solution

Thanks to HTML5, it is as easy as this:

<input type='file' required />

Example:

<form>
  <input type='file' required />
  <button type="submit"> Submit </button>
</form>

Problem

I want to make (an HTML) 'file' input element mandatory: something like ``` <input type='file' required = 'required' .../> ``` But it is not working. I saw this WW3 manual which states 'required' attribute is new to HTML 5. But I am not using HTML 5 in the project I am working which doesn't support the new feature. Any idea?

Original source