Pages

Monday, 26 August 2013

How to move Add new item link to top location in SharePoint 2010

Add new item link to top:

Recently my client request to me for moving “Add new Item” link to top location instead of bottom of every web part. Actually for adding new item user first click on tab (in ribbon bar) and then click on New Item button. Which is taking time and not a very good practice.
Secondly, if there are many items are saved in list or library then user have to scroll down and then click on Add new item link. That is also tedious.
Solution:
We will use jQuery for moving Add new item link from bottom to top location, for this we generically add the following script in master page. It will move all the Add new item links to top of each web part at run time in browser.
<script src=”http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js type=”text/javascript”></script>
<script language=”javascript” type=“text/javascript”>
$(document).ready(function () {
$(“td.ms-addnew“).parent().parent().parent().each(function () {
$(this).insertBefore($(this).prev());
});
});
</script>
You can also add this script to CEWP on page and the result will be same but on specified page.

No comments:

Post a Comment