<textarea id="metaSourceText" name='key' style="width:100%" class="text ui-widget-content ui-corner-all" rows="1"></textarea>
我试过了
$metaSourceValue = $('metaSourceText').val();
alert($metaSourceValue);
但它显示“未定义”
最佳答案
您的代码只需调整为如下所示:
var metaSourceValue = $('#metaSourceText').val();
alert(metaSourceValue);
您在向 jQuery 发出 ID 信号的 metaSourceText 之前缺少哈希值。而且您通常不希望以 $ 开头变量
关于javascript - 如何用jQuery读取文本区域的内容?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5079013/