Problem validating form fields as required

0

asked by anonymous 01.09.2017 / 22:43

1 answer

1

ForEach in each input of the form and check if they are required

$('#form').find('input').each(function(){
   if(!$(this).prop('required')){
     // É required
   } else {
     // Não é required
   }
});

In order for the input to be red-colored, you can use jQuery to change the input css, and change the outline to red.

    
01.09.2017 / 23:17