Share via

SharePoint 2013 EditForm.aspx headings - Javascript

Anonymous
2018-04-17T14:13:12+00:00

I have followed a solution on another thread in order to add headings to my SharePoint 2013 edit form and have added the script to the library as well as the code to the page. Everything works as expected, but the code (partially below) states "h3:contains("Author")".

 $('<tr><td colspan="2"><h4>HSE Metadata</h4></td></tr>').insertBefore($('h3:contains("Author")').parent().parent());

We have a field called 'Author' and one called 'Author - New' and the above code adds the heading above both fields separately, but it should only be added above the first.

Can anyone help please?

Microsoft 365 and Office | SharePoint | For business | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

3 answers

Sort by: Most helpful
  1. Anonymous
    2018-04-18T13:38:05+00:00

    It's working correctly because both fields DO contain "author".  Repeat that for the column with "author-new" or find some other way to differentiate between the 2 fields. 

    <script src="http://code.jquery.com/jquery-latest.js" type="text/javascript"></script>

    <script type="text/javascript">

    $(document).ready(function(){ $('<tr><td colspan="2"><h4>HSE Metadata</h4></td></tr>').insertBefore($('h3:contains("Author"):not(:contains("-"))').parent().parent()); });

    </script>

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2018-04-18T03:02:26+00:00

    It's working correctly because both fields DO contain "author".  Repeat that for the column with "author-new" or find some other way to differentiate between the 2 fields.

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2018-04-17T17:19:01+00:00

    Hi Dedre,

    Based on your description, the problem you have is related to use code to do the customization in SharePoint, we suggest you post a thread in our MSDN forum for the professional assistance.

    Thanks for your understanding.

    Tisky

    Was this answer helpful?

    0 comments No comments