So I have a 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++;
}
}
So the textarea with id entry1 has a description like "this is a story" when the page initially loads. Once I type something into that text area, and then hit a button whose only function is:
alert($("#entry1").text());
I still get "this is a story". Why isn't the textarea being updated with the text that I've typed in?
You want to use $("#entry1").val()
to get the text within the textarea.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With