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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T02:31:37+00:00 2026-06-02T02:31:37+00:00

Okay, here we go… I have a page XYZ with a button that’s supposed

  • 0

Okay, here we go…

I have a page XYZ with a button that’s supposed to call my function:

$(function() {


    $('#addgroupicon').on('click', function(event){

        addgroup();

    }); 

});


function addgroup()
{
$('#addgroupdialog').show();
}

// #addgroupdialog and #addgroupicon are within the loaded page, the above code is inside a .js file that I load in the header of the index.html

now I’m loading this page XYZ into a div with the .load() function, but when i click the button nothing happens. I also tried to add onclick=’javascript:addgroup();’ to the button, with no success.

can anyone help me?

  • 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-02T02:31:39+00:00Added an answer on June 2, 2026 at 2:31 am

    You’re not using "on" in the right way. It should be used like this:

    $(document).on("click", "#addgroupicon", function(event){
            addgroup();
    }); 
    

    See the following fiddle which mimics your scenario, I think exactly:

    http://jsfiddle.net/U4xZj/

    To explain why, because I don’t think the jquery docs do a very good job at this…
    Basically, if you think about what you’re doing with “on” in the way you were using it:

    $('#addgroupicon').on('click', function(event){
    

    You’re saying, ok jQuery, I want to create an event handler for the following selector, “addgroupicon”. Jquery promptly turns around and goes “great!” #addgroundicon has exactly ZERO items that match it. Go away and stop bothering me. But doing it with $(document) first, jquery goes, “oh, ok. I can certainly create a click event handler for document. Now, if you only want me to raise this event when certain elements caused the click, then please provide a selector, and if the selector matches the source element, then I will call your callback.” Make sense?

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

Sidebar

Related Questions

Okay here is what I'm trying to do: I have a model object that
Okay so here is the code that I am using function AddProducts($aTitle, $aDescription, $aPrice,
Okay here's the program I have typed up(stdio.h is included also): /* function main
Okay so here is my database: I have a page on my .net form
Okay so here's the situation. I have this page of data. After the data
Okay so here my issue, I have a list of items that when a
Okay, I'm confused here. I have a properties file with some SQL scripts that
Okay here's the situation. Net 4 WPF NO Silverlight. I have several Views that
Okay here's my situation. I have the following branches development development-kirby (270 commits ahead
Okay basically here's where I'm at. I have a list of PropertyDescriptor objects. These

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.