Contents
How to add Jquery to MasterPage 2013
- Copy jquery – “jquery-1.11. min.
- Copy seattle.html and add
- Upload seattle.html as ASP NET MASTERPAGE.
- Publish it —> Nothing happend.
You can put =”text/javascript” src=”/_layouts/Scripts/jquery-min.</b> <b>js”> in master page to access this javascript globally in all pages. Or you can put that script tag in your custom webpart / content editor webpart / script editor webpart to access that script only for that webpart only.
How to include jQuery in SharePoint 2010 / 2013?
Lots of time you may require to refer jQuery file references in SharePoint 2010/2013 page. In this case, we can add the jQuery file reference inside the master page in SharePoint 2010/2013. To call jQuery through the master page, we should have permission to edit master pages. This is one of the simplest and direct approaches.
Where do I Save my jQuery code in SharePoint?
Now Save the file with a name (Here name is MyJavaScript.txt). Now we can put the text file in the Site Assets Library and also we can put the code in the layouts folder. Copy the text file and put it inside the C:\\Program Files\\Common Files\\Microsoft Shared\\Web Server Extensions\\14\\TEMPLATE\\LAYOUTS\\STYLES folder.
Modify JQuery and all additional libraries to be in the SharePoint namespace To add a file into a namepsace surround it with this code: This will ensure correct On Demand loading and it won’t break the MDS feature.
If you’re following that tutorial, remember that in SharePoint 2013 the LAYOUTS directory has a /15/ node. So in SP2010, the path might have been /_layouts/awesomeness/jquery.js but that exact same path in SharePoint 2013 might be /_layouts/15/awesomeness/jquery.js. In addition, it might be suggested to avoid registering jQuery within master page.