I'm using jQuery inside of a SharePoint 2010 to create an image gallery. The gallery works perfectly and there are no problems. The gallery is entirely generated using jQuery and all HTML objects are inserted dynamically into the DOM (ie: there is ZERO HTML contained in the CEWP - Javascript only.)
The problem occurs when I go later to edit the Javascript inside of the CEWP - I can see the orginal Javascript requesting generation of the image gallery and, this is the strange part, the CEWP has all of the generated HTML right there.
So now, when I save, I save the script to generate the gallery AND the HTML that was previously generated effectively duplicating the gallery. If I edit again then I will now have three galleries and so on.
How can I use Javascript to insert DOM elements and not have the generated HTML appear in the CEWP?
