Solved

Jquery and internal elements

Posted on 2011-02-16
4
536 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 51

Accepted Solution

by:
HainKurt earned 500 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 51

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 51

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

jQuery is a JavaScript library that greatly simplifies JavaScript programming. AJAX is an acronym formed from "Asynchronous JavaScript and XML."  AJAX refers to any communication between client and server, when the human client does not observe a…
Introduction HyperText Transfer Protocol (http://www.ietf.org/rfc/rfc2616.txt) or "HTTP" is the underpinning of internet communication.  As a teacher of web development I have heard many questions, mostly from my younger students who have come to t…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…

911 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now