Thanks Brian for your help

most of the help that I've found at other places was kinda sketchy at
best or was use livequery, Livequery is a nice tool for most
situations but when you start attaching events to hundreds of objects
it will slow a page right to a crawl which is why I was looking into
event handeling IE rebinding and event delegation event delegation
means probably less coding and faster loading I'm told but with a good
explination of how to rebind objects manualy I'm sure I can manage
from there too

> I don't understand the question. What "object"? The anchor *inside*
> the div? You could use find('a') on the event target (the div) and
> check the className.

Being an self taught old school C coder I thought it would be easier
to migrate to PHP but I cant really complain other than my termanology
yes thats exactly correct the anchor inside the div

just curious would this after reloading the content div without
binding will this find any anchor elements loaded inside the div and
report them to the alert box
note I removed the 'li' from parent()

$('#content a').click(function(event)
{
        alert($(this).parent().attr('id'));
        event.preventDefault();
});

if it works I could use a select to execute the correct script
oh I cant wait to get home its my weekend this weekend...

even if that doesn't I'm pretty sure that removing that anchor that
was loaded in the new content would allow it to return the id of the
parent of a clicked object ...

$('#content').click(function(event)
{
        alert($(this).parent().attr('id'));
        event.preventDefault();
});

and if that dosent I'm sure that thiere is information in the link to
help me with binding ...

Thanks a lot Brian you have but a lot of pep back in my step ... I
just have to watch out for those ceiling fans for an hr or 2

talk to ya later
John




On Jan 3, 8:10 pm, brian <bally.z...@gmail.com> wrote:
> On Sat, Jan 3, 2009 at 8:06 PM, brian <bally.z...@gmail.com> wrote:
> > On Sat, Jan 3, 2009 at 4:36 PM,  <holandmij...@gmail.com> wrote:
>
> >> My question's are
>
> >>  1.  If you have a Div class= content with children anchors. Then
> >> empty and load in new content in that div with children anchor those
> >> anchors will get the same event handling that the previous anchors had
> >> right?
>
> > No (well, not exactly). Any click handlers you set on elements in that
> > div will not be bound to anything if you remove the content. This is
> > precisely what liveQuery deals with. It "watches" for new elements
> > which match the selectors given earlier for bind event handlers.
>
> Sorry, I meant to add this link to the docs, which gives the lowdown
> on this (most) frequently asked question:
>
> http://docs.jquery.com/Frequently_Asked_Questions#Why_do_my_events_st...

Reply via email to