gpt4 book ai didi

jquery - Textarea 没有在 jQuery 中获取更新的文本

转载 作者:行者123 更新时间:2023-12-03 22:11:59 25 4
gpt4 key购买 nike

所以我有一个 Razor View :

@{
int i=1;
foreach(var story in Model.Storylines)
{
<span style="float:left;">Storyline @i</span> <span style="float:right; margin-right:5px;">Character Count: @story.CharCount</span><br /><br />
<textarea id=@("entry"+@i) rows="5" style="width:730px; overflow:auto;">@story.Description</textarea><br /><br />
i++;
}
}

因此,当页面最初加载时,ID为entry1的文本区域有一个类似“这是一个故事”的描述。一旦我在该文本区域中输入一些内容,然后点击一个按钮,其唯一功能是:

alert($("#entry1").text());

我仍然明白“这是一个故事”。为什么文本区域没有更新为我输入的文本?

最佳答案

您想要使用 $("#entry1").val() 获取文本区域内的文本。

关于jquery - Textarea 没有在 jQuery 中获取更新的文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7192696/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com