When users click on Title field from AllItems.aspx page, I want to redirect them to EditItem.aspx instead if DispForm.aspx page.

I have written following code. It's working fine for first 30 items(Page limit is 30).

<script type="text/javascript">
$(function() {
  // Change all display form links to edit form links
  $('.ms-vb a[href*="listform.aspx"]').each(function(){
      var link = $(this).attr('href');
      link = link.replace("PageType=4", "PageType=6");
      $(this).attr('href', link);

But if I navigate through pagination, link is still same as PageType=4 and link is set to DispForm.aspx. How to overcome this issue?

  • You have tagged the question with both enterprise and online. What version\type of UI? Feb 3, 2020 at 10:36
  • What version of SharePoint you are using? Do you have access to SharePoint designer?? Feb 3, 2020 at 10:44
  • 2
    I believe the JavaScript based views (not just modern list experience but 2013 as well), do not reload the page when navigating through pages, so your script might not be called for subsequent pages. You've might just edit the list-view web-part and check "Server Render" under "Miscellaneous" for an easy fix. In my opinion, creating a custom client-side rendering for the title-column is generally a better idea. However, you could also modify the view to include the "Edit (Link to edit item)" column, which renders a small edit icon which takes you to the edit form also.
    – J. Tihon
    Feb 3, 2020 at 10:49

3 Answers 3


Instead of doing all such code, you may use this workaround.

  1. Remove all your code
  2. Modify your view
  3. Enable Edit (link to edit item) under the columns group enter image description here

  4. Your view will be enabled with direct link to edit icon enter image description here

You can propose this solution.

Else, If you really want to link the Title field to edit form

  1. You can add a script in DispForm.aspx and redirect to EditForm.aspx
  2. Handle it in Client Side Rendering script

These are the easiest options.


Using JQuery like this will not work as this code will not execute again on pagination.

So, I will suggest you to use the Client Side Rendering like below:

(function () {
    function registerRenderer() {
        var ctxForm = {};
        ctxForm.Templates = {};

        ctxForm.Templates = {
            Fields : {
                'LinkTitle': { //------ Change Hyperlink of LinkTitle
                    View : function (ctx) {
                        var url = String.format('{0}?ID={1}', "/sites/SiteName/Lists/ListName/EditForm.aspx", ctx.CurrentItem.ID);
                        return String.format('<a href="{0}" onclick="EditItem2(event, \'{0}\');return false;">{1}</a>', url, ctx.CurrentItem.Title);
    ExecuteOrDelayUntilScriptLoaded(registerRenderer, 'clienttemplates.js');

Here I have added the edit form link on Title (linked to item with edit menu) column whose internal name is LinkTitle. If you want to add it on another column then you need to add the internal name of your column instead of LinkTitle.

You can get the internal name of any of your list columns by following this article: How to find the Internal name of columns in SharePoint Online?

How to set the JSLink property of your Web Part:

For detailed steps, check my answer given at: sharepoint 2013 list expand/collapse multiple line text column


The sample you proposd only works for Title field i added Edit (link to edit item) But the links only appeared on the Title field. Also changed to a different column but no luck

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.