Link to home
Start Free TrialLog in
Avatar of gbeaulac
gbeaulac

asked on

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?

ASKER CERTIFIED SOLUTION
Avatar of HainKurt
HainKurt
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
try something like this:

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

after creating a new element with id=myID
Avatar of gbeaulac
gbeaulac

ASKER

@HainKurt

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

GB
welcome :) glad it worked... jQuery intrduced this fueature recently i guess (oops they added with 1.3)...