-1

I have a form and some of the <textarea> values are coming filled by backend. When submitting I want to send inner HTML to the backend, when sending only the pre-filled are having values when calling their .html() but not <textareas> filled by the client. Any idea why this happens? I do the followings

I call this to get complete form html : $('#myform').html(); By calling this only pre-filled textarea is coming with the text in it like below

<teaxtarea name="t1" id="t1_001">The pre-filled text</textarea>

but for the text areas having text added from the client comes like this

<teaxtarea name="t2" id="t2_002"></textarea>

even if there is text added by the client.

Juliyanage Silva
  • 2,529
  • 1
  • 21
  • 33

1 Answers1

1

Found the answer...

When I call this $('#myform').html(); it does not take the textarea element with it's value rather the text enclosed by textarea tags. Since invoking .val() and .text() returns two separate values I called .text('value entered by client') when the user type on the textarea through a keypress event handler. This fixed my problem.

Juliyanage Silva
  • 2,529
  • 1
  • 21
  • 33