I wanna know how to use jquery script in my Web Page part?
For example. I have visual web part. I use jquery like this
<%@ Assembly Name="$SharePoint.Project.AssemblyFullName$" %><%@ Assembly Name="Microsoft.Web.CommandUI, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %><%@ Register TagPrefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %><%@ Register TagPrefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %><%@ Register TagPrefix="asp" Namespace="System.Web.UI" Assembly="System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" %><%@ Import Namespace="Microsoft.SharePoint" %><%@ Register TagPrefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %><%@ Control Language="C#" AutoEventWireup="true" CodeBehind="VisualWebPart2.ascx.cs" Inherits="useriai.VisualWebPart2.VisualWebPart2" %><script type="text/javascript" src="http://code.jquery.com/jquery-2.0.2.js"></script><script type="text/javascript" src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script><link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" /><script type="text/javascript"> $(document).ready(function(){ alert("hello"); })</script>
I see my "hello" mesage and everything works.
But i need to create Web part page. So i go to sharepoint designer-> site pages -> webpart page-> and create "mypage.aspx" -> press on that file -> edit file. Now i see this code:
<%-- _lcid="1033" _version="15.0.4420" _dal="1" --%><%-- _LocalBinding --%><%@ Page language="C#" MasterPageFile="~masterurl/default.master" Inherits="Microsoft.SharePoint.WebPartPages.WebPartPage,Microsoft.SharePoint,Version=15.0.0.0,Culture=neutral,PublicKeyToken=71e9bce111e9429c" meta:webpartpageexpansion="full" meta:progid="SharePoint.WebPartPage.Document" %><%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Register Tagprefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Import Namespace="Microsoft.SharePoint" %> <%@ Assembly Name="Microsoft.Web.CommandUI, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Register Tagprefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages" Assembly="Microsoft.SharePoint, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %><asp:Content ContentPlaceHolderId="PlaceHolderPageTitle" runat="server"><SharePoint:ListItemProperty Property="BaseName" maxlength="40" runat="server"/></asp:Content><asp:Content ContentPlaceHolderId="PlaceHolderAdditionalPageHead" runat="server"><meta name="GENERATOR" content="Microsoft SharePoint" /><meta name="ProgId" content="SharePoint.WebPartPage.Document" /><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><meta name="CollaborationServer" content="SharePoint Team Web Site" /><SharePoint:ScriptBlock runat="server"> var navBarHelpOverrideKey = "WSSEndUser";</SharePoint:ScriptBlock><SharePoint:StyleBlock runat="server"> body #s4-leftpanel { display:none; } .s4-ca { margin- }</SharePoint:StyleBlock></asp:Content><asp:Content ContentPlaceHolderId="PlaceHolderSearchArea" runat="server"><SharePoint:DelegateControl runat="server" ControlId="SmallSearchInputBox"/></asp:Content><asp:Content ContentPlaceHolderId="PlaceHolderPageDescription" runat="server"><SharePoint:ProjectProperty Property="Description" runat="server"/></asp:Content><asp:Content ContentPlaceHolderId="PlaceHolderMain" runat="server"><div class="ms-hide"><WebPartPages:WebPartZone runat="server" title="loc:TitleBar" id="TitleBar" AllowLayoutChange="false" AllowPersonalization="false" Style="display:none;"><ZoneTemplate><WebPartPages:TitleBarWebPart runat="server" HeaderTitle="Untitled_1" Title="Web Part Page Title Bar" FrameType="None" SuppressWebPartChrome="False" Description="" IsIncluded="True" ZoneID="TitleBar" PartOrder="2" FrameState="Normal" AllowRemove="False" AllowZoneChange="True" AllowMinimize="False" AllowConnect="True" AllowEdit="True" AllowHide="True" IsVisible="True" DetailLink="" HelpLink="" HelpMode="Modeless" Dir="Default" PartImageSmall="" MissingAssembly="Cannot import this Web Part." PartImageLarge="" IsIncludedFilter="" ExportControlledProperties="True" ConnectionID="00000000-0000-0000-0000-000000000000" ID="g_1d32c784_7ae3_4301_be08_ee8fd8519c6a" AllowClose="False" ChromeType="None" ExportMode="All" __MarkupType="vsattributemarkup" __WebPartId="{1D32C784-7AE3-4301-BE08-EE8FD8519C6A}" WebPart="true" Height="" Width=""></WebPartPages:TitleBarWebPart></ZoneTemplate></WebPartPages:WebPartZone></div><table class="ms-core-tableNoSpace ms-webpartPage-root" width="100%"><tr><td id="_invisibleIfEmpty" name="_invisibleIfEmpty" valign="top" width="100%"> <WebPartPages:WebPartZone runat="server" Title="loc:FullPage" ID="FullPage" FrameType="TitleBarOnly"><ZoneTemplate></ZoneTemplate></WebPartPages:WebPartZone> </td></tr><SharePoint:ScriptBlock runat="server">if(typeof(MSOLayout_MakeInvisibleIfEmpty) == "function") {MSOLayout_MakeInvisibleIfEmpty();}</SharePoint:ScriptBlock></table></asp:Content>
Where should i insert jquery code?
<script type="text/javascript" src="http://code.jquery.com/jquery-2.0.2.js"></script><script type="text/javascript" src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script><link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" /><script type="text/javascript"> $(document).ready(function(){ alert("hello"); })</script>