我需要获取用户在JSP脚本中的文本区域中输入的文本。我尝试了这个代码,但得到了空值:
<label for="userText"></label>
<textarea name="userText" id="userText">text edited by the user</textarea>
<button onclick="myFunction()">Ok</button>
function myFunction() {
<%System.out.print(request.getParameter("userText"));%>
}
我能拿到吗?
您必须使用Java脚本进行
var message = $('textarea#userText').val();