views:

174

answers:

2

I need to rewrite a classic ASP page such that it will be compatible with Internet Explorer, Firefox and Safari. The current implementation uses a method, replaceAdjacentText to manipulate the DOM. As far as I can tell this method is not supported in any browsers other than Internet Explorer.

What I would like to do is replace the use of replaceAdjacentText with something that will work across multiple browser platforms. Is this possible with an existing jQuery plugin or perhaps some other alternative?

A: 

jQuery almost certainly has something for you but in general it sounds like you're looking for the DOM traversal properties and methods of the Node interface, in particular previousSibling, nextSibling and firstChild. Loose example here. One thing to watch out for is the nodetype that you get returned, gecko adds a whitespace text node to the DOM, where IE does not.

Lots of tutorials on JS DOM traversal to google as well.

annakata
+1  A: 

Use jQuery Manipulation

try using these methods with jQuery:

append(), appendTo(), prepend(), prependTo(), after(), before(), insertAfter(), insertBefore()

hunter