jsp could not submit a solution for the content in nicEdit

  • 2020-05-30 20:56:16
  • OfStack

During the course of google (" NicEdit cannot get textarea values under JQuery "), I got an inspiration that I could first use js to read the contents of nicEdit's rich text editor, assign its contents to textarea, and then submit the form. The code is:

<textarea name="intro" rows="15" cols="30" id="introContent" style="width: 750px; height: 300px; border: 1px solid #000;">${sightInfo.introduction}</textarea>
<input type="button" value=" submit " onclick="$('#introContent').val($('.nicEdit-main').html());$('form').submit();" />


This code ensures that the content in nicEdit is assigned to the textarea element before the form is submitted. This way, when you read the value "intro" in servlet, it will not be empty.

Related articles: