Solved

Jquery and internal elements

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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Suggested Solutions

Hello World !, Thanks : My Sincere thanks to @Michael Male who encouraged me to write an article on this in my  blog (http://scribblejava.wordpress.com). Introduction:       There are several technical issues a developer may face in his…
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…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

757 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