Hi all, I'm going to append on to this thread since it seems to be
related...
I'm trying to dynamically build a tree from ajax calls using jQuery. The
actual code is more complicated than I'm listing here, but I'm trying to get
to the crux of the problem which is:
Can jQuery append to elements that were created by jQuery?
Here's a simplified example. The static HTML page consists of:
<div id="main-block">
</div>
A jQuery call like this builds an inner block. This code works fine:
$(document).ready(function() {
$.get("getTitle.ajx", { id : test }, function(content) {
("#main-block").append("<div id=\"inner-block-title\">"
+ content
+"</div><div id=\"inner-block\"></div>");
});
});
I also have a function defined like:
function addInnerBlock() {
$.get("getInnerBlock.ajx", { id : test }, function(content) {
$("inner-block").append(content);
});
}
When I call addInnerBlock() from a button on the page the browser (firefox)
does not update to show the content of the call in the #inner-block div.
It's almost as if the browsers does not allow modifications to the
"generated" DOM for things that work fine for the "static" DOM.
Thanks,
Galen
On 1/20/07, Jacky <[EMAIL PROTECTED]> wrote:
append() can add child by html/dom object.
Can u give an example?
What is your response format? html? json?
On 1/20/07, Dmitrii 'Mamut' Dimandt < [EMAIL PROTECTED]> wrote:
>
> I'm slightly confused.
>
> How does one add children to a DOM element using jQuery?
>
> There are append*, prepend*, insert* methods, but none of them seem to
> actually add a child *inside* a jQuery/DOM element.
>
> Why do I need this?
>
> I need to create a list inside a div from some data that comes, say,
> from an AJAX response. How do I do that?
>
> _______________________________________________
> jQuery mailing list
> [email protected]
> http://jquery.com/discuss/
>
--
Best Regards,
Jacky
網絡暴民 http://jacky.seezone.net
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/