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

  • SEARCH
  • Home
  • 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 6587783
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T16:57:45+00:00 2026-05-25T16:57:45+00:00

a = new object(); a.loadInterface(); $(button).click(function() { a.doSomething(); }); The problem is that a.loadInterface()

  • 0
a = new object();
a.loadInterface();

$("button").click(function() {
    a.doSomething();
});

The problem is that a.loadInterface() is what loads the button into the DOM, and it happens at the end of a $.post() because data from the server is needed to populate some attributes of the button.

So what I think is going on is, JavaScript reads the button.click detector but at that time there is no button for it to bind to.

Any ideas?

  • 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-05-25T16:57:46+00:00Added an answer on May 25, 2026 at 4:57 pm

    Your assessment of the problem is correct. A simple solution would be to use delegate. E.g.,

    $(document).delegate('button', 'click', function() {
        a.doSomething();
    });
    

    Edit: more info on delegate and why it works on dynamically created elements after event binding can be found here: http://api.jquery.com/delegate/

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

Sidebar

Related Questions

Is it like... var obj = new Object(); obj.function1 = function(){ //code } or
I understand that any init... method initializes a new object and that NSString stringWithString
Trying to do an insert, I have: jdbcTemplate.update(insert into...., new Object[]{foo.getId(), foo.getName()}) foo.getId() returns
the new object structure in 1.9 embeds some ivars into objects for faster access:
When designing a new object model I always start with the class diagram function
I insert a new object into LINQ-to-SQL DataContext without calling SubmitChanges() yet: MyDataContext db
If I create a new object that includes two object pointers (see below) when
When you create a new object in C++ that lives on the stack, (the
Try the following code: myListener = new Object(); myListener.onKeyUp = function() { if (Key.isDown(Key.CONTROL)
Is it possible to add a new object that Ninject should be responsible for

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.