Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Jquery and internal elements

Posted on 2011-02-16
4
Medium Priority
?
543 Views
Last Modified: 2012-06-21
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
Comment
Question by:gbeaulac
  • 3
4 Comments
 
LVL 61

Accepted Solution

by:
HainKurt earned 2000 total points
ID: 34909955
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
 
LVL 61

Expert Comment

by:HainKurt
ID: 34909992
try something like this:

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

after creating a new element with id=myID
0
 

Author Comment

by:gbeaulac
ID: 34910076
@HainKurt

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

GB
0
 
LVL 61

Expert Comment

by:HainKurt
ID: 34910372
welcome :) glad it worked... jQuery intrduced this fueature recently i guess (oops they added with 1.3)...
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today I am discussing AJAX problems in IE7 and I bet this will helps many guys out here who have problems with AJAX work. Lets start with the discovery of problem and then we will talk about its different solutions. My last two projects included …
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses

886 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question