Home > Content Editor Webpart, SharePoint 2010 > How to use html and JavaScript in Content Editor web part in SharePoint2010

How to use html and JavaScript in Content Editor web part in SharePoint2010

Here are the steps you need to take to use html and JavaScript in content editor web part.

1. Edit a site page and add a content editor web part on the page.


2. After the content editor is added to the page, it will display on the page like shown below


3. Next, upload your html and JavaScript content as a text file to a document library inside your SharePoint site.

Here is the content in the document

<script type="text/javascript">
alert("Hello World");
</script>

4. Edit the content editor web part and reference the file you just uploaded.


5. Save the page and you will see the hello world prompt.

References:
http://stackoverflow.com/questions/5020573/sharepoint-2010-content-editor-web-part-duplicating-entries
http://sharepointadam.com/2010/08/31/insert-javascript-into-a-content-editor-web-part-cewp/

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: