Well, I am going to post an article that is based on very basic things about how we can start working with jQuery in SharePoint 2013. If you are already an expert in using jQuery in SharePoint 2013, then please ignore this post and read my other posts.
jQuery in SharePoint
To give the reference for the jQuery files either you can download and store in some document library in your SharePoint 2013 site or you can directly refer from the CDN which provided from Google, Microsoft or jQuery itself like below:
- Google Path: http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js
- Microsoft Path: http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.6.2.min.js
- jQuery Path: http://code.jquery.com/jquery-1.6.2.min.js
If you will download and store it in your document library then you can give the path like below:
But it is not a good approach to put the code directly on the page. So what you can do is you can save the code in as a .js file and save it in some document library preferable you can store in SiteAssets library.
And then you can add a content editor web part and then you can give the file path as:
Then save the page, the alert box should come. One advantage, you can get is next time suppose you want to modify the js then no need to edit the page and modify the code, you can modify the js file and upload it to the same document library.
And also if you want to get the older versions of the file then you can get it from the version history.
You may like following SharePoint jQuery tutorials:
- Display SharePoint list data in jQuery data table using Rest API
- Create a Custom Calendar in SharePoint using Rest API and jQuery
- Display SharePoint List items in a data table using Rest API and jQuery
- Populate dropdown using jQuery from array
- jQuery Tooltip Using Visual Studio
- Send Email with jQuery and REST API in SharePoint
- SharePoint 2013 Arranging Choice Field CheckBoxes on SharePoint Forms using jQuery
- Add jQuery in visual web part in SharePoint
- SharePoint 2013: Show/Hide Delete Icon In Ribbon On List Item Selection using jQuery
- Bind SharePoint list data using jQuery datatable using content search web part in SharePoint
I hope this will be helpful to start with jQuery in SharePoint Online or SharePoint 2013/2016 or SharePoint 2019.
I am Bijay from Odisha, India. Currently working in my own venture TSInfo Technologies in Bangalore, India. I am Microsoft Office Servers and Services (SharePoint) MVP (5 times). I works in SharePoint 2016/2013/2010, SharePoint Online Office 365 etc. Check out My MVP Profile.. I also run popular SharePoint web site SPGuides.com
Download SharePoint Online Tutorial PDF FREE!
Get update on Webinars, video tutorials, training courses etc.