0

I'm trying to get the value of a SharePoint list multiline of text field using jQuery. I tried using:

var titleValue = $("input[Title='Title']").val(); but it returns undefined.

and also the following returns empty string:

var multiline = $("textarea[Title='multiline']").closest("span").find("iframe[Title='Rich Text Editor']").contents().find("Body").text(); 

Can anyone please help?

1
  • are you using enhanced rich text ? Jul 17, 2018 at 10:40

2 Answers 2

0

Try:

function PreSaveAction()
{
    //Plain text
    var value= $("textarea[title='Title']").val();
    console.log(value);
};
2
  • 1
    also returns undefined
    – Vusi85
    Jul 17, 2018 at 10:33
  • ok, this other value, look at field (column) is form F12: var title = $("#ctl00_m_g_a770fe86_1f9d_4b62_929e_69a2d1180c92_ff21_ctl00_ctl00_TextField_inplacerte").html(); Jul 17, 2018 at 10:35
1

For Title:

As the Title field is required field code snippet would be:

var titleValue  = $("input[title='Title Required Field']").val();

For Multiple lines of text:

var multiline = $("textarea[title='multiline']").val();
7
  • Thanks Gopal, 2 example html value (<div class="ExternalClassB80F926ACB7447459E9E79351D2F6B29"><p>​value</p></div>), needed add code substring+lastindexof() Jul 17, 2018 at 11:01
  • var multiline = $("textarea[title='multiline']").val(); - is undefined Jul 17, 2018 at 11:05
  • Is your column type plain text or enhanced rich text ? Jul 17, 2018 at 11:06
  • Sorry my mistake :)) Jul 17, 2018 at 11:09
  • Good for you. You learnt something ;) Jul 17, 2018 at 11:09

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.