Try creating a small, trimmed down test case ... removing other elements
from the page. You should be able to find what is causing the problem then.
The only reason live query would be attaching the event to all a tags is if
your selector a[rel=sec] matches all your a tags. You might want to try
running some code in firebug to see what results you are actually getting
from that selector.

--
Brandon Aaron

On 10/3/07, bluejam <[EMAIL PROTECTED]> wrote:
>
>
> Hi
> im using the very latest version of jQuery
>
> I can't post example online as its on my dev server and the project is
> too hush hush to show just yet
>
> the code that adds the element works fine, its Live Query that is not
> working as it adds the event to all 'a' elements
> and I tried your code it made no difference.
>
> thank you anyway, might just have to go back to the old reliable page
> refreshing method
>
> On Oct 3, 2:05 pm, "Brandon Aaron" <[EMAIL PROTECTED]> wrote:
> > Which version of jQuery are you using? Could you post the code that adds
> the
> > element? Better yet could you post an example online?
> >
> > Also if you are just binding an event, you shouldn't use the function
> > syntax. Do it like this:
> >
> > $('a[rel=sec]').livequery('click', function() {
> >     doSomething();
> >
> > });
> >
> > --
> > Brandon Aaron
> >
> > On 10/3/07, bluejam <[EMAIL PROTECTED]> wrote:
> >
> >
> >
> > > Hi
> >
> > > Im adding an element to Dom on fly, I then want to add an action to
> > > that element, i've tried live query but it is adding the action to ALL
> > > elements not just the one i referenced.:
> >
> > > This is being added to:
> >
> > > <h1><span>Clothing / Accessories ยป<a id="1_12" rel="sec"
> > > href="javascript:;">Tailoring</a></span></h1>
> >
> > > which works fine, now im referencing the rel="sec" and adding an
> > > action the the click event:
> >
> > > $(function() {
> > >         $("[EMAIL PROTECTED]'sec']").livequery(function(){
> > >                 $(this).bind('click',function(){
> > >                         $("#top").ScrollTo(800);
> > >                         //showSector($('[EMAIL PROTECTED]',
> > > this).attr("id"));
> > >                 });
> > >         });
> > > });
> >
> > > the commented out part is the function i eventually want to call, im
> > > just using the ScrollTo action for testing purposes
> >
> > > The problem i have is the live query is adding the click action to ALL
> > > a elements, anyone come across this before ? or know how to add a
> > > click action to an element that is created on the fly?
>
>

Reply via email to