Nov 8, 2018

Example of Attributes for web page accessibility

All inputs that have errors should have an attribute of aria-invalid="true", inputs that don't have an error should have aria-invalid="false" OR just not have the attribute at all

Each error message should be associated with a unique id. Any fields that have an error should have an attribute of aria-describedby="{ID OF ERROR MESSAGE}"

All required fields should have an attribute of aria-required="true"

<input id="id_email" name="email" type="text" data-validation="email" aria-required="true"  aria-describedby="id_email_desc">

if(email == ""){
$('#id_email').attr("aria-invalid", "true");
$('.errors').append("<div  id='id_email_desc'>-Valid email is required</div>");
}else{
$('#id_email').attr("aria-invalid", "false");
}