我如何获得在jQuery的一个textarea的价值? [英] How do I get the value of a textarea in jquery?
本文介绍了我如何获得在jQuery的一个textarea的价值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何获得textarea的价值jQuery的,如果我使用
How to get Textarea value in jquery, if I am using
<form name="myform">
<textarea name="msg" id="msg"></textarea>
</form>
本语法不能正常工作
var text = $('textarea#message').val();
有谁能够告诉我的事情?
can anybody tell me about the things ?
推荐答案
你的想法是对的,但你的选择是有点过了:
Your idea is right, but your selector is a bit off:
$('textarea#msg').val(); //not "message"
在 ID-选择需要严丝合缝的ID:)
The ID of the ID-selector needs to match exactly :)
这篇关于我如何获得在jQuery的一个textarea的价值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文