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 8480061
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T19:12:03+00:00 2026-06-10T19:12:03+00:00

I am trying to execute the alert message after the execution of the trigger

  • 0

I am trying to execute the alert message after the execution of the trigger event. My code :

 $(".addpage").trigger("click").queue(function () { 
  alert($(".page:first-child").attr("id")); 
 });

But here problem is the alert is executing before completing the trigger event function. What i am doin wrong here?

  • 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-10T19:12:04+00:00Added an answer on June 10, 2026 at 7:12 pm

    Here i have done complete bins for above issue. please find demo link and check it out..

    Demo: http://codebins.com/bin/4ldqp7m

    HTML

    <ul id="pages">
      <li class="page" id="1">
        Page-1
      </li>
      <li class="page" id="2">
        Page-2
      </li>
      <li class="page" id="3">
        Page-3
      </li>
      <li class="page" id="4">
        Page-4
      </li>
    </ul>
    

    jQuery

    $(function() {
        $(".addpage").click(function(e) {
            var newId = parseInt($("#pages li.page:last").attr('id')) + 1;
            $("#pages").append("<li class='page' id='" + (newId) + "'>Page-" + (newId) + "</li>");
    
        });
        $(".addpage").trigger('click');
        $(".addpage").queue(function() {
            alert("New Page with Id #" + $("#pages li.page:last").attr('id') + " has been added...!");
        });
    });
    

    CSS:

    #pages{
      list-style:none;
      margin:5px;
      padding:2px;
      width:120px;
    
    }
    #pages li{
      border:1px solid #1A1A1A;
      width:120px;
      background:#4fdefd;
      text-align:center;
    
    }
    .addpage{
      background:#53a5f9;
      border:1px solid #1142fd;
    }
    .addpage:hover{
      background:#53cdfa;
    }
    

    Demo: http://codebins.com/bin/4ldqp7m

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

Sidebar

Related Questions

I'm trying to execute an external function on click of a DOM element without
I am trying to execute a snippet of JS only once, after the page
I'm trying to create a function that will execute on a click, on the
Trying to execute powershell script in my C# code. Using .NET Framework v. 4.0.30319
Im trying to execute a .bat file remotely in a powershell script. The code
I`m trying to execute linux commant 'cat' from java code, but it does not
I'm trying to execute the following code, but I'm getting SyntaxError: invalid syntax at
Have some simple jquery that Im trying to execute on a button click. For
Trying to execute this: function getReport(name) { $.ajax({ type: POST, url: reportAjax.php, data: name=+
I'm trying to execute JavaScript functions that are called when a event (for example

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.