Then it looks like you want $(childObj).parent().prepend('<div id="result_message">Result Processed</div>');
That will get you the 1 immediate parent of that element. - Richard On Fri, Feb 22, 2008 at 11:49 AM, AsymF <[EMAIL PROTECTED]> wrote: > > If I do the following I end up with every single DIV all the way up > the document chain being prepended with the content instead of its > immediate parent: > var msg_selector = $($(childObj).parent().get(0).tagName + ':has(#' + > childObj.id + ')') > $(msg_selector).prepend('<div id="result_message">Result Processed</ > div>'); > > What this is used for is that when a link is clicked it sends AJAX > data. If the data was processed remotely it is supposed to show a > simple success message at the top of the parent DIV it is located in. > > Any idea what I am doing wrong? > > On Feb 22, 6:32 am, "Richard D. Worth" <[EMAIL PROTECTED]> wrote: > > I'm not sure I understand what you're trying to get at. If you have an > > element (childObj), it has only one parent, $(childObj).parent(). > Perhaps > > you want to provide some more context if I'm not getting it? > > > > - Richard > > > > On Thu, Feb 21, 2008 at 3:48 PM, AsymF <[EMAIL PROTECTED]> > wrote: > > > > > How would I select the parent that ONLY has that child? > > > > > For instance, the following selects too many parents: > > > $($(childObj).parent().get(0).tagName + ':has(#' + childObj.id + ')') > > > > > On Feb 21, 2:25 pm, "Richard D. Worth" <[EMAIL PROTECTED]> wrote: > > > > See > > > > > >http://docs.jquery.com/Traversing/parent#expr > > > > > >http://docs.jquery.com/Traversing/parents#expr > > > > > > - Richard > > > > > > On Thu, Feb 21, 2008 at 12:33 PM, AsymF <[EMAIL PROTECTED] > > > > > wrote: > > > > > > > How would I select the ancestor or parent of an element? >