I'm overriding the Display Form of a list as per Mark Rackley's blog post: http://www.sharepointhillbilly.com/Lists/Posts/Post.aspx?ID=47
For this particular list, I need to parse a text field, split it into an array, and build a table containing the array elements. However I can't seem to access the text of any elements on the form. The very same code/html functions as expected in the Edit Form, so I feel I've narrowed the culprit to something in the Display Form.
An element like:
<span class="formOverride" id="rName" data-displayName="Requisition Name"> <!-- FieldName="Requisition Name" FieldInternalName="Title" FieldType="SPFieldText"--> "Test Requisition" </span>
Returns empty with:
var testString = $("#rName").text(); alert("'" + testString + "'");
I've tried a number of selectors, including plain JS, and they all return an empty string. Again, the very same code in the Edit Form returns the string as expected.
The data shows in the page source, and in Inspect Element from Chrome. Inspect DOM Properties of the element in question also shows that the data is available, but the selectors just don't pick it up.
Anyone know of something in the SharePoint 2013 Display Form that would prevent script from accessing text? When I remove the
text(), the alert gives the generic
[object Object] output, so the selector seems to be picking the element up, just not the text...