Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8238255
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T19:44:54+00:00 2026-06-07T19:44:54+00:00

I am using a jQuery plugin for showing notifications. so i can use something

  • 0

I am using a jQuery plugin for showing notifications.

so i can use something like this

show_notification("Successfully Saved your data","success");

we can use html content as message.

Now i want to perform some actions

ex.

show_notification("Do you want to save your data","success");

so this is a question to the user and user need to reply by clicking yes or no [both will be passed as html message]

what i need to do is when user clicks on yes/no i need to perform some actions.

i can use id or class to attach a click event,but i have many types of actions,and need to use very different id or class.

can i use a call back function or something like that ?

Please help me or give me your valuable suggestions .

Thank you.

Note : I know that it is not possible with current plugin and not talking about its functionalities ,i am just trying to modify the plugin.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T19:44:55+00:00Added an answer on June 7, 2026 at 7:44 pm

    In case there is no way to send a callback to your plugin, you would have to manually add the Yes/No-buttons to your message, and target them either by live delegates or by assigning a listener after the notification has been shown.

    $(function() {
    
        $('body').on('click', '.notification-yes', function() {
           // yes-callback
        });
    
        $('body').on('click', '.notification-no', function() {
           // no-callback
        });
    
    });
    
    show_notification('Do you want to proceed? <button class="notification-yes">Yes</button> <button class="notification-no">No</button>', 'success');
    

    If it is this plugin that you’re using, you’ll want your listeners to call closeNotification(). I realize that the syntax is not exactly the same, but that could be a versioning issue. It’d be easier to help you with the specifics if we knew the details of the plugin you’re using.

    You’ll also need a way of knowing which notification was showing when the button was clicked. You could of course have unique button class names for different notifications. Another approach, if there is always just one notification showing at any given time, would be to have a small state object for the callback of interest. For instance:

    var myNotifications = {
        onYes: function() { },
        onNo: function() { }
    };
    
    $(function() {
        $('body').on('click', '.notification-yes', function() {
           myNotifications.onYes();
           closeNotification();
        });
    
        $('body').on('click', '.notification-no', function() {
           myNotifications.onNo();
           closeNotification();
        });
    });
    
    function showCertainNotification() {
        myNotifications.onYes = function() {
            // specific callback for this notification.
        };
    
        show_notification('Confirm? <button class="notification-yes">Yes</button> <button class="notification-no">No</button>', 'success');
    }
    

    If there could be several notifications showing at any one time, a simple variable like that won’t do. In that case you’d have to wrap your message in a container, the ID of which you could extract from your listener, and call a specific callback based on that, or passing that as a parameter. I won’t go into detail here, seeing as the simple nature of show_notification implies an equally simple manner of close_notification. Since no ID’s seems to be anywhere to be found, I’ll assume that multiple active notifications are not supported.

    A more appealing solution might have been to modify the plugin itself, rather than to work around it, so that you could pass callback functions directly to the plugin. Something like this:

    show_notification({
        message: 'Confirm',
        type: 'success',
        buttons: [
            { caption: 'Yes', click: function() { } },
            { caption: 'No',  click: function() { } }
        ]
    });
    

    But of course, this is no way near possible to help you with, without first having a chance to look at what the plugin you’re currently using looks like.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im using this jquery autocomplete plugin. The data format for autocomplete is like the
I'm using Datatables and have this jquery plugin showing in a few columns http://www.erichynds.com/jquery/jquery-ui-multiselect-widget/
I'm using the VTicker jquery plugin for showing top news of my web site.
I'm using this jquery plugin to build forms. In order to allow the modification
I am using jQuery fullcalendar plugin , I have tried altering this many different
hai.all..can you tell me how to make table in jquery? i want using this
I'm trying to rewrite a Mootools tooltip class in JQuery using this class plugin
I am using jquery flash plugin for showing audio clip i had tried in
the jquery plugin that im using is this http://code.google.com/p/jquery-in-place-editor/ if i have a table
i have an input using the jquery autocomplete plugin. with this i want to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.