> > > First of all, does the click have to be in the last paragraph itself? > > > Or could it be in some parent container of the paragraphs? > > > [...snip...] > > > > fran wrote ... > > it's not possible to use the parent, I need the identified paragraph in > the > > ajax-call > > I guess the question is whether you can bind the event handler to the > container. The click event will still have a target that points to > your paragraph (or one of its children, and that's an annoying, but > tolerable, complication), so you can still use the paragraph to help > with your Ajax call.
yes. You're right. I have to rework my assumption: It's possible to bind the click event to one of its parents and I can get the clicked element with var target = $(event.target); as found in your sample code. I reworked my code, this works fine but I encountered a new problem: It's not be done appending a new paragraph and catching the click event in one of it's parents. I even have to bind some additional events to the new paragraph elements. You wrote: > If $content already has children("a"), then you will be binding the > same event handler again. This might do better: > > $("<s> ... </s>").appendTo($content).children("a").click( function() > { > AJAX-call > }; > > In this case, you will bind the click handler this time only to the > "a" children of the newly appended portion. this is the trace to find solutions for the new problems. My XML structure is as follows [content] [s] [a]...[/a] [b]...[/b] [/s] [/content] I append a [s] element, the click on the new [a] or [b] is well be caught in [content] - that works fine - but I have to bind additional events to [s], [a] and [b] [s] should get a hover-handler [a] & [b] should get an other hover-handler I have to code this additional functionallity and I think it can be done with something similar to your code > $("<s> ... </s>").appendTo($content).children("a").click( function() I will go on ... thanks for your proposals and links to solutions -- fran btw { the target variable in your sample code has a $-prefix ($target). I think this is just an eye-catcher for variables - a similar coding to php. If not - if it has to do with something special in Javascript or jQuery - please let me know ... } -- View this message in context: http://old.nabble.com/jQuery-%2B-OOP-%2B-AJAX-tp26945051s27240p26976695.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.