How to apply JQuery to PHP generated HTML?

Mauldor

New Member
I have a PHP file that is generating HTML elements, and is being called from AJAX when the page loads. What I am looking to do is apply JQuery to the dynamically generated elements, so for each time a label, generated from the PHP file, is clicked something happens. I tried placing the JQuery code in the PHP file and echo it out, but that didnt work, I also placed the code in the HTML page, where the AJAX is being called, but that didnt work either.In my HTML I have:\[code\]<body onLoad="javascript:getLabels();">, \[/code\]This calls the php file through AJAX:\[code\]function getComments() { var thePage ='loadLabels.php'; ... \[/code\]The PHP file as the line: \[code\]echo '<label id="labellink" class="ldClass">Label </label>'; \[/code\]which could be more then one label in the page once loaded, but all in their one \[code\]<form>\[/code\], so I need to use JQuery so once the labels are loaded and I click on them, I can make something happen.
 
Back
Top