使用jQuery获取Textarea的价值 [英] Getting Textarea Value with jQuery

查看:80
本文介绍了使用jQuery获取Textarea的价值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这让我发疯-为什么我的代码不起作用?

This is driving me crazy - why doesn't my code work?

<a id="send-thoughts" href="">Click</a>
<textarea id="#message"></textarea>

            jQuery("a#send-thoughts").click(function() {
                var thought = jQuery("textarea#message").val();
                alert(thought);
            });

未定义警报.

http://jsfiddle.net/q5EXG/

推荐答案

您有id="#message" ...应该是id="message"

http://jsfiddle.net/q5EXG/1/

这篇关于使用jQuery获取Textarea的价值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆