javascript - Replace <span> element with var containing html -


I have a variable, I have picked up the contents of a page from that page, such as:

  var originContents = $ ('# orig .teleportMe'). Html ();  

Span is a set of tags, which is class = "InsertionPoint" on the page, I want to remove it from the original div content and change it.

I like to do it with jquery, but not necessarily.

Change this with the contents of: originContents

  & lt; Span class = "insertionpoint" & gt; Insert & lt; / Span & gt;  

Oh and hide the original after it's done.

should do this:

$ ('.notpoint' ). Replacewith (originContents); $ ('#include .teleportMe'). Hide (); See

and note that if the HTML contains elements with IDs and HTML is now included in many places, then using these ID can have unexpected results.


Comments