0

I am struggling with SharePoint and JQuery.

I tried to add new HTML elements to a a SP 2013 New form. So I fired following command in the Chrome dev console:

$("select[title='TEST']").closest("td").after("<td>test</td>");.

Well, SharePoint render the query as: "<td>test</td>" and not as <td>test</td>.

Do you have a idea?

  • Sorry what is the problem? Does it render a plain text instead of html? I have tried and it added word 'test' as expected. – Raf Dec 4 '19 at 12:48
  • @Raf: yes, exactly – grill1992 Dec 4 '19 at 12:58
  • I have tried to use your code and it works properly for me. – Raf Dec 4 '19 at 13:02
  • 1
    I think it is Chrome or jquery issue. Not SharePoint. – Raf Dec 4 '19 at 13:07
0

Steps to do :

  1. Try to work in another Browser
  2. Review your jQuery
  3. try to use '' instead of ""
  4. If not, try to do some control to skip the quotes ""
0

Add the following code to a script editor web part in newform page.

<script type="text/javascript" src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script type="text/javascript">
$(function(){
    $("select[title='TEST']").closest("td").after("<td>test</td>");
})
</script>

Or using the following line of code.

$("select[title='TEST']").closest("tr").append("<td>test</td>");

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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