I have a problem with alert messages. It is displayed normally, and i can close it when the i presses x (close), but when i try to display it again (for example, click on the button event) then it is not shown.
Moreover, if i print this alert message to console, it is equal to [].
Below is my code of alert box:
Actually the problem is "data-dismiss" completely removes the element. Use jQuery's .hide() method instead of data-dismiss like below:
Please comment if you like this post..
Inspired By #stackoverflow
Chears :)
Happy Coding..
Moreover, if i print this alert message to console, it is equal to [].
Below is my code of alert box:
<div class="alert" style="display: none">
<a class="close" data-dismiss="alert">×</a>
<strong>Warning!</strong> Best check yo self, you're not looking too good.
</div>
Solution : Actually the problem is "data-dismiss" completely removes the element. Use jQuery's .hide() method instead of data-dismiss like below:
<div class="alert" style="display: none">
<a class="close" onclick="$('.alert').hide()">×</a>
<strong>Warning!</strong> Best check yo self, you're not looking too good.
</div>
Please comment if you like this post..
Inspired By #stackoverflow
Chears :)
Happy Coding..