I am using Jquery to display notification at the top of my webpage. I am using the following function to display the notification bar -
function myBar(message) {
$("<div />", { class: 'mybar', text: message, id: 'mymsg' }).hide().prependTo("body")
.slideDown('slow');
}
And in $(document).ready(function(){
I am calling the myBar("my message");
, with appropriate css. It is displaying the bar as required.
Now I want to hide the bar when one clicks on the bar. For that I am trying this
$("#mymsg").click(function() {
$(this).remove();
})
But this is not working as such. Any suggestions on what might be wrong?