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?

  • are you using enhanced rich text ? – Gopal Zadafiya Jul 17 '18 at 10:40
0

Try:

function PreSaveAction()
{
    //Plain text
    var value= $("textarea[title='Title']").val();
    console.log(value);
};
  • 1
    also returns undefined – Vusi85 Jul 17 '18 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(); – Fox Jul 17 '18 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();
  • Thanks Gopal, 2 example html value (<div class="ExternalClassB80F926ACB7447459E9E79351D2F6B29"><p>​value</p></div>), needed add code substring+lastindexof() – Fox Jul 17 '18 at 11:01
  • var multiline = $("textarea[title='multiline']").val(); - is undefined – Fox Jul 17 '18 at 11:05
  • Is your column type plain text or enhanced rich text ? – Gopal Zadafiya Jul 17 '18 at 11:06
  • Sorry my mistake :)) – Fox Jul 17 '18 at 11:09
  • Good for you. You learnt something ;) – Gopal Zadafiya Jul 17 '18 at 11:09

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.