1

I need to add a span element to a specific in Sharepoint List New Form.But, how to get that specific td element using jquery ot javascript. Anyone can help me in this?enter image description here

beside to single line text field i have to append span tag.how can i get that specific td.

  • You want to get the value of input text box (as a td element) ? – Sohail Shaikh Oct 15 '18 at 12:17
  • Not to get the value of input text box .I want to get the <td> element of the above text box... – Swetha Paritala Oct 16 '18 at 4:54
  • Please refer to my answer, hope it helps! – Sohail Shaikh Oct 24 '18 at 16:36
1

To find the Span element, do the following.

  • Select New Form - copy the url and paste in to Google Chrome.

  • Press F12 - to open developer view. Then click on the symbol I've circled in red:

Dev View

The span in the above picture is of the options in a choice field.

In the picture below the span is of the field name:

span field name

  • i dont have <nobr> tag in my accordion UI. so am stuck at how to add this? – userAZLogicApps Apr 5 at 8:07
  • 1
    The <nobr> is wrapped around the field name. If you have no <nobr> that would suggest to be that you have no fields present on your form...or, having done a quick search I found this explanation which should help :-) stackoverflow.com/questions/28532076/why-is-the-nobr-deprecated – Tally Apr 16 at 9:22
1

To get specific <td> tag in Sharepoint List New Form, Try this

$('h3:contains("Field Name")').closest('td').next('td')

Edit based on your comment

To append an HTML tag like span or div, do the following:

$('h3:contains("Field Name")').closest('td').next('td').append("<span>Test</span>");
  • within this td($('h3:contains("Field Name")').closest('td').next('td')) how to add span element? – Swetha Paritala Oct 16 '18 at 7:11
  • if its an accordion UI, then the above wont work!! if i add this $('h3:contains("Field Name")').closest('td').next('td').append("<span>Test</span>"); , it will not show accordion ui at all! – userAZLogicApps Apr 5 at 8:05
0

To append span element to td using jQuery:

var spanTag = "<span></span>";
$('h3:contains("Field Name")').closest('td').next('td').append(spanTag);

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.