Aria-required on jquery submit form
let's say has the following form
<form action="post">
<label for="firstName">First name:</label>
<input id="firstName" type="text" aria-required="true" />
<input type="submit" value="submit">
</form>
and with jQuery i want to do $.post()
i use the following jQuery script
jQuery(function($){
$(SUBMIT_BTN).on('click', function(e){
var data = $('form').serialize() + '&action=save_customer';
$.ajax({
url: MYRUL,
method: 'POST',
data: data,
success: function(response){
$('form').trigger('reset');
}
});
});
});
with this script the required aria does not work. how to trigger the check in this case?
PS: I want to use this aria-required
one while avoiding jQuery plugins
+3
source to share