Hi I would like to remove the 'required=""' attribute with jquery.
<input type="text" id="edit-submitted-first-name" name="submitted[first_name]" value="" size="30" maxlength="128" required="" >
To remove all attributes of elements, we use removeAttributeNode() method.
Just unset the required attribute. If you're trying to unset it after some user action (with javascript) then use the . removeAttribute("required") function.
$("input"). attr("required", "true");
Just:
$('#edit-submitted-first-name').removeAttr('required');
If you're interested in further reading take a look here.
If you want to set required to true
$(document).ready(function(){ $('#edit-submitted-first-name').prop('required',true); });
if you want to set required to false
$(document).ready(function(){ $('#edit-submitted-first-name').prop('required',false); });
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With