I’m looking for a way to automatically add the “required” attribute to all of my input fields for HTML5 validation. However, I’m having trouble finding a way to use jQuery to dynamically add the “required” attribute to input fields.
Here is the HTML I have.
<input type="text" name="first_name" id="first-name">