Thursday 19 June 2014

SharePoint 2013 Add Custom JavaScript

SharePoint 2013 Add Custom JavaScript
Open SharePoint 2013 site
Click on "Edit" icon the top right
Click on Insert
Select Web Part
Click on "Media and Content” category
Select "Script Editor"
Click "Add"
Select Script Editor Web part
Click on Edit web part
You will see "EDIT SNIPPET"
Click on "EDIT SNIPPET"
You will get a prompt, where you can enter the JavaScript.
I have sample JavaScript
Add below code in to prompt.
<html>
<head>
<script language="javascript">

function ShowAlert()
{
alert("Welcome to Script Editor web part in SharePoint 2013");
}
</script>
</head>
<body>
Click on Show Alert ....
<input type="button" value="Show Alert" onclick="ShowAlert()";/>
</body>
</html>
Click on Insert
Click on Save
Click on "Show Alert" button, you will get alert...