Hi I have the following alert that is hidden on the page
<div class="alert alert-success" id="selectCodeNotificationArea" hidden="hidden">
<button type="button" class="close" data-dismiss="alert">×</button>
@TempData["selCode"]
</div>
I display it with the following javascript
$('#send_reject_btn').click(function () {
var selRowIds = $("#ApprovalGrid").jqGrid('getGridParam', 'selarrrow');
if (selRowIds.length > 0) {
$('#reject_alert').show();
} else {
$('#selectCodeNotificationArea').show();
}
});
This is obviously linked to a button in my html.
After the alert is shown if I close it using the<button type="button" class="close" data-dismiss="alert">×</button>
The next time I press the button to open the alert I can see $('#selectCodeNotificationArea').show();
being called in my debug screen but the alert doesn't display again.
Has anyone experienced this before?
The Data-dismiss completley removes the element. You would need to hide the alert if you are intending on showing it again.
For example;
<div class="alert alert-success" id="selectCodeNotificationArea" hidden="hidden">
<button type="button" class="close" data-hide="alert">×</button>
@TempData["selCode"]
</div>
and this JS
$(function(){
$("[data-hide]").on("click", function(){
$(this).closest("." + $(this).attr("data-hide")).hide();
});
});
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments