Wally Kolcz
Wally Kolcz

Reputation: 1664

Removing required from a form element via Javascript

I have a form that hides and shows option based on a drop down. If one option is selected there is a form that had required fields (). If the other option is selected I need to disable those required fields or the form won't submit.

Long and short. How do I remove the required for the input element via Javascript?

I was trying document.getItemById('firstName').?

Upvotes: 0

Views: 62

Answers (1)

Wally Kolcz
Wally Kolcz

Reputation: 1664

document.getElementById('firstName').removeAttribute('required');

Upvotes: 1

Related Questions