<script type="text/JavaScript">
var amount_payable = $("#amount_payable").val();
var error = document.getElementById("show_result");
if(amount_payable ==""){
error.class Name="alert alert-danger";
error.inner HTML="<center><strong>Error:</strong> Amount Payable is
missing, return to Student's Dashboard, and try again.</center>";
$('html, body').animate({
scroll Top: $("#show_result").offset().top
}, 800);
}
// #show_result is the div id targeted
</script>
I'm trying to validate my form with JavaScript, so i want to scroll up so the user can see the error div above form.