I am trying to find all the fields with required attribute and they should be visible too. Because page can have hidden required fields too. Here i
required
visible
If you want to find input, textarea,or select elements that have the attribute required and are visible use the has attribute selector:
$('input,textarea,select').filter('[required]:visible')
or
$(':input[required]:visible')//might be little costlier