Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to close a jgrowl manually

All,

How to close and open a jgrowl manually

 jQuery("div.jGrowl").trigger("jGrowl.close");

The above code doesnt seem to work.

Thanks.

like image 639
Hulk Avatar asked Feb 19 '10 11:02

Hulk


3 Answers

This worked for me

$("div.jGrowl").jGrowl("close");
like image 161
Saiful Avatar answered Nov 11 '22 17:11

Saiful


Three options:

$('div.jGrowl').find('div.jGrowl-notification').children().parent().remove();

$('div.jGrowl').find('div.jGrowl-notification').trigger('jGrowl.close');

$('div.jGrowl').find('.jGrowl-close').trigger('jGrowl.close');

Any of them close all notifications. I'm not sure how to close an individual notification, though.

like image 2
Fernando Avatar answered Nov 11 '22 17:11

Fernando


This one worked for me, closing the last notification:

$('div.jGrowl-close').triggerHandler('click');

Edit: Improved efficiency by replacing trigger with triggerHandler. See http://api.jquery.com/triggerHandler/

like image 2
squarebrackets Avatar answered Nov 11 '22 19:11

squarebrackets