I am using Javascript inside the SharePoint 2010 Content Editor web part to insert a Silverlight object. I need to do this this way, instead of using the Silverlight Web Part, as Silverlight Web Part is not currently included. This is done entirely with Javascript.
The problem occurs when I switch later to edit Javascript inside CEWP. I see that the original Javascript is requesting the generation of a Silverlight object, and I can, this is the weird part, CEWP has all the generated HTML code. The Silverlight object is right there attached to scrept.
So now, when I save, I save the script to create the Silverlight object AND the HTML that was previously generated, effectively duplicating the Silverlight object. If I edit again, now I will have three Silverlight objects, etc.
You can see this in action for yourself with the following code example:
Save the web part and you're done. Now just keep editing CEWP. Each time you click “Edit Web Part”, “Hello” will be added to your script.
How can I use Javascript to insert DOM elements and not have the generated HTML in CEWP?
javascript sharepoint-2010
user433245
source share