In script validation my code like this,
if (!obj.checked){
        if (attendance_tardy.checked == true){
            attendance_tardy.click();
        }
        absentType.required = true; // flash error message
        dropdown.style.display = "block";
        remark_div.style.display = "block";
        tardy_div.style.display = "none";
        remarks.required = true;
    }else{
        dropdown.style.display = "none";
        absentType.required = false;
        remark_div.style.display = "none";
        tardy_div.style.display = "block";
        remarks.required = false;
    } }  
In this, I want to scroll where the error displayed by required term. What code want to be add? I am not clear view with this. Someone Help me.
EDIT
This is my div part in view page,   
<div id="reason<%= index.to_s %>" <% if (list.attendance_status == true) then %> style="display: none;" <% end %>>
                        <% if (@absenteelists != nil) then %>
                            <%= collection_select(:absent, 'absent_type'+index.to_s, @absenteelists, :parameter, :value,
                            {:prompt => "Select Reason", :selected => list.absent_type},
                            {:class => "country_code-drpdwn select2"}) %>
                        <%else%>
                            <select id="absent_absent_type"+index.to_s name="absent[absent_type]" class="country_code-drpdwn select2">
                                <option value="">Select Reason</option>
                            </select>
                        <%end%>
                    </div>
Thanks.
