would work
but apparently because of event bubbling, I'll read up on that
many thanks again
On 28 Feb, 18:52, Karl Swedberg <k...@englishrules.com> wrote:
> Ah, in that case you might want to use the .live() binding:
>
> $( "#wiki_content a" ).live('click', function(event) {
> event.preventDefault();
> var link = $(this).text();
> searchDelay( link );
>
> });
>
> --Karl
>
> ____________
> Karl Swedbergwww.englishrules.comwww.learningjquery.com
>
> On Feb 28, 2009, at 11:35 AM, hybris77 wrote:
>
>
>
> > thanks for the feedback, that is a much better solution, however
> > I don't seem to be getting hold of the <a> tags that im after, the
> > problem might be the fact that the div containing the tags is not yet
> > populated when the jquery function to get them runs... but im not sure
>
> > the div #wiki_content is populated using a AJAX call just before
> > the code im posting here, it contains a set of <p> tags with <a>
> > tags in them but pointing at the div itself will get hold of the
> > a tags right?
>
> > On 28 Feb, 17:27, Karl Swedberg <k...@englishrules.com> wrote:
> >> I think it would be a lot simpler to rely on jQuery's implicit
> >> iteration:
>
> >> $( "#wiki_content a" ).click(function(event) {
> >> event.preventDefault();
> >> var link = $(this).text();
> >> searchDelay( link );
>
> >> });
>
> >> --Karl
>
> >> ____________
> >> Karl Swedbergwww.englishrules.comwww.learningjquery.com
>
> >> On Feb 28, 2009, at 10:50 AM, hybris77 wrote:
>
> >>> can anyone please see waht's wrong with this
>
> >>> I want to get all <a> tags in the div #wiki_content and get the text
> >>> from
> >>> it and send into a function called searchDelay... im not getting as
> >>> far as
> >>> jumping into the $.each loop so not sure waht's wrong
>
> >>> var links = $( "#wiki_content a" );
>
> >>> $.each( links, function( event ){
> >>> $(this).click(function( event ){
> >>> event.preventDefault();
> >>> var link = $(this).text();
> >>> searchDelay( link );
> >>> });
> >>> });
>
> >>> many thanks
No comments:
Post a Comment