Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 547
  • Last Modified:

Jquery and internal elements

I created 4 <select> elements using a jQuery in my html page. Once they are generated I want to attach a .change event to each select to call yet another ajax function. it does not work. Why?

I presume it is because the elements (select) don't exist in the html?

0
gbeaulac
Asked:
gbeaulac
  • 3
1 Solution
 
HainKurtSr. System AnalystCommented:
any sample code?

check this link

http://api.jquery.com/live/

.live()

Description: Attach a handler to the event for all elements which match the current selector, now and in the future.

0
 
HainKurtSr. System AnalystCommented:
try something like this:

$('#myID').live('change',function() {
  alert('change event for dynamic component');
});

after creating a new element with id=myID
0
 
gbeaulacAuthor Commented:
@HainKurt

Thank you so much! That worked! I'm so grateful. Thank you. thank you. Thank you.

GB
0
 
HainKurtSr. System AnalystCommented:
welcome :) glad it worked... jQuery intrduced this fueature recently i guess (oops they added with 1.3)...
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now