如何在jquery中获取textarea的值?
16lz
2021-01-22
How to get Textarea value in jquery, if I am using
如果我正在使用,如何在jquery中获取Textarea值
<form name="myform">
<textarea name="msg" id="msg"></textarea>
</form>
This syntax is not working properly
此语法无法正常工作
var text = $('textarea#message').val();
can anybody tell me about the things ?
任何人都可以告诉我这些事情吗?
6 个解决方案
#1
7
Your idea is right, but your selector is a bit off:
你的想法是正确的,但你的选择器有点偏:
$('textarea#msg').val(); //not "message"
The ID of the ID-selector needs to match exactly :)
ID选择器的ID需要完全匹配:)
更多相关文章
- jquery之data()、stop()、delay()的语法和使用
- js字符串与html代码互相转换时怪想法:自己解析js字符串成普通字
- 韩顺平_轻松搞定网页设计(html+css+javascript)_第19讲_js运行原
- 在Emacs中将语法突出显示的代码转换为HTML
- 尽管“SQL语法错误”消息仍然成功执行
- PHP中的替代语法
- 解析错误:语法错误,E:\xampp\htdocs\online\viewhistory >中
- PHP 5.0 到 7.1 常用语法糖(个人整理)
- 解析错误:语法错误,第12行/home/public_html/gigs.html中的意外T_L