Reputation: 69
I inject the alert dynamically:
$('#'+this.id).append('<div id="alert" class="alert alert-success alert- dismissible" style="display:none;width:50%;" role="alert">'+
'<button id="alertclosebutton" type="button" class="close" data- dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span> </button></div>');
when i get an ajax return i show the alert:
$('#alert').css("display", "block");
$('#alert').text(realmsg);
I cannot make the close button show.. I want it to be with display none not hidden to save space on the screen..
Upvotes: 1
Views: 47
Reputation: 1395
$('#alert').text(realmsg);
This statement removes the inside button and added the message , If its right? then you can add one div for your message like below.
<div id="alert" ... >
<div class="messagediv">your message area</div>
<button id="alertclosebutton" ../>
</div>
$('#alert').find('.messagediv').text(realmsg);
Upvotes: 1