James, yes. Dead on and I have it working now. The event delegation/event bubbling proved difficult as the event.target.id of the freshly loaded anchor tags didn't seem to be available to me (needed for show()ing the corresponding div).
What did work was rebinding the event at the end of the ajax call (within the function just after the return). Luckily for me, unbinding and binding didn't appear to be necessary. At least if I run into problems with it, I'll know where to look. The help was much appreciated. Thank you! On Aug 13, 8:36 pm, James <james.gp....@gmail.com> wrote: > Are the <a> tags that you're binding the click event to introduced > into the DOM from the showHint AJAX request? > If so, read this: > Why do my events stop working after an AJAX > request?http://docs.jquery.com/Frequently_Asked_Questions#Why_do_my_events_st... > > On Aug 13, 8:16 am, Patrick <niftyg...@gmail.com> wrote: > > > New to jQuery, I did many searches before posting. > > > This is happening in both IE6 and Firefox 3.0.13. I've gotten the > > following script to work under strange circumstances (explained below > > first snippet). > > > jQuery(document).ready(function(){ > > showHint(""); // ajax that fires onload, with no problem (but did > > try taking it out with same results) > > $("a").click(function () { > > alert("hi onclick"); // stuck this in there but doesn't fire > > either. > > var avid; > > avid = "#div" + $(this).attr("id"); > > alert(avid); // this won't work either. > > $(avid).fadeIn("slow"); > > $(avid).css({display: block}); // added this extra when fadeIn > > didn't work. > > }); > > > }); > > > When I'm able to successfully get both the alert and the rest of the > > script to work is when I add another alert in the ready() section. > > Then, the code works for the rest of the browser session (even after > > the 'ready ()' alert is removed). > > > jQuery(document).ready(function(){ > > showHint(""); // ajax/json > > alert("hi on load"); // after inserting this, the below all works > > ****************** > > $("a").click(function () { > > alert("hi onclick"); // stuck this in there but doesn't fire. > > var avid; > > avid = $(this).attr("id"); > > avid = "#div" + avid; > > alert(avid); > > $(avid).fadeIn("slow"); > > $(avid).css({display: block}); // added this extra when fadeIn > > didn't work. > > }); > > > }); > > > Any clue why this would be happening? > > > Thanks, > > Pat.