Close Bootstrap modal on form submit
give id to submit button
<button id="btnSave" type="submit" class="btn btn-success"><i class="glyphicon glyphicon-trash"></i> Save</button>
$('#btnSave').click(function() {
$('#StudentModal').modal('hide');
});
Also you forgot to close last div.
</div>
Hope this helps.
You can use one of this two options:
1) Add data-dismiss to the submit button i.e.
<button type="submit" class="btn btn-success" data-dismiss="modal"><i class="glyphicon glyphicon-ok"></i> Save</button>
2) Do it in JS like
$('#frmStudent').submit(function() {
$('#StudentModal').modal('hide');
});
Use that Code
$('#button').submit(function(e) {
e.preventDefault();
// Coding
$('#IDModal').modal('toggle'); //or $('#IDModal').modal('hide');
return false;
});
Add the same attribute as you have on the Close button:
data-dismiss="modal"
e.g.
<button type="submit" class="btn btn-success" data-dismiss="modal"><i class="glyphicon glyphicon-ok"></i> Save</button>
You can also use jQuery if you wish:
$('#frmStudent').submit(function() {
// submission stuff
$('#StudentModal').modal('hide');
return false;
});