Hi Jim, > I'm using MochiKit with TurboGears and am trying to find how I can get > a reference to the immediate parent of a node in the DOM. I see that > getFirstParentByTagAndClassName is available in 1.4, but I'm using > 1.3.?? in TurboGears. Is there a relatively easy way to get a > reference to it?
node.parentNode would be a good choice - has nothing to do with MochiKit and everything to do with DOM :) > Alternatively, what I'm really trying to do is to swap out a node with > some new html. I've tried using the swapDOM method, but it seems like > I need to create a DOM node for the second parameter of the method. > But, I have raw HTML in a string variable that I'm trying to swap in. > Needless to say, I'm quite new to this. Is there a way to convert my > raw HTML into a DOM node tree? Well, you actually still cannot, because you will need to use innerHTML and then you will not only replace this immediate child node but also potentials siblings. But if it has no siblings, you can use: node.parentNode.innerHTML = "<b>foo</b>". :) -- Morten Barklund - Head of Development - TBWA\PLAY --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "MochiKit" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/mochikit?hl=en -~----------~----~----~----~------~----~------~--~---
