You do not need to create a IIFE here like you have in first example, just define a normal function here:
function ShowNotification(message) {
$.notify(message);
});
It is not working because you are calling the function just after creation and passing
jQuery
as parameter to the function while you intend to pass message to the function from calling side.
You would have to call it from the click event function this way:
(function () {
$('.demo-1').on('click', function (e) {
e.preventDefault();
ShowNotification('I am a alert box.');
});
})(jQuery);