Below indicated is my HTML code, its a Bootstrap modal popup. What I am trying to do is if user clicks on save button, I am doing some sort of validation and if the validation fails, the message is displayed and should automatically scroll up to the top of the modal popup. but its not scrolling up. Below I have also indicated my code from JS file.
<div id="addD" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="addPatientLabel" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="addLabel">Create</h3>
</div>
<div class="modal-body">
<p class="validateTips"></p>
<table>
<tr>
<td class="TemplateLabel">
Name:
</td>
<td align="left">
<input placeholder="name" type="text" name="Name" data-bind="value: NewP.Name" id="SignUpName" class="SignUp text ui-widget-content ui-corner-all" />
</td>
</tr>
</table>
</div>
<div class="modal-footer">
<button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
<button class="btn btn-primary" onclick="SaveD()">Save changes</button>
</div>
</div>
In my JS file:
function SaveD() {
debugger;
var bValid = true;
bValid = bValid && CheckRequired($('#SignUpName'));
if (bValid) {
/*Some func called*/
}
else
{
$('#addD-content').scrollTop(0);
}
}
Any help? Basically $('#addD-content').scrollTop(0);
is not working.