Why don't you use the ID of the a tag? The ID is a unique reference,
so then you're sure you're targeting the correct a tag and none of the
others.

On 3 okt, 13:53, 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