I have my modal defined in cshtml as shown below. When I click on the cross mark or on the close button, I want to perform some action but the hide event is not getting fired.
<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> Here is my js code:
$(document).ready(function () { $('#AddD').on("hidden", function () { debugger; alert("blah"); }); }