jQuery
New Wave Javascript
discuss » dynamically loading html into a container and then....
Posted: Tue Jan 31 16:47:55 EST 2006
From: Mark Panay <
markpanay at gmail.com
>
ok thanks, i'll try this.
i'm not sure what the .html does?
mark.
On 31/01/06, John Resig <
jeresig at gmail.com> wrote:
>
Hi Mark,
>
>
Let's see if I can figure this out... So you've loaded a bunch of LIs
>
into an UL. So, for simplicity, let's say you do:
>
>
$("ul")
>
.html(... all your LIs, loaded from somewhere ...)
>
.find("li")
>
.click(function(){
>
alert(this.innerHTML);
>
});
>
>
Now, I think that should do the trick, if I'm not mistaken. I was
>
doing some similar code recently, and I remember doing something like
>
that. Let me know if this helps you out.
>
>
--John
>
>
On 1/31/06, Mark Panay <markpanay at gmail.com> wrote:
>
> Another quick question that i'm sure is already sorted in JQuery...
>
>
>
> I can dynamically load html into a container using AHAH, no problem.
>
> But the only way (that i know how) to attach events to this "new" html
>
> is add the evnts to each element in the remote page... they do not
>
> seem to attach, i presume some sort of refresh is necessary?
>
>
>
> What I would like to do is load an unordered list (with no javascript)
>
> attach an event to each LI and then be able to tell which one is which
>
> (i.e. the contents) when it's clicked.
>
>
>
> At the moment I attach a unique ID to each LI and a javascript
>
> function call with the unique ID on the server...
>
>
>
> I hope thismakes sense..
>
>
>
> Thanks (again)
>
>
>
> mark.
>
>
>
>
>
> --
>
> Mark Panay
>
> www.MarkPanay.com
>
>
>
> _______________________________________________
>
> discuss mailing list
>
> discuss at jquery.com
>
> http://jquery.com/mailman/listinfo/discuss_jquery.com
>
>
>
>
>
--
>
John Resig
>
http://ejohn.org/
>
jeresig at gmail.com
>
>
_______________________________________________
>
discuss mailing list
>
discuss at jquery.com
>
http://jquery.com/mailman/listinfo/discuss_jquery.com
>
--
Mark Panay
www.markpanay.com
Jargon Free Web Development