JavaScript, HTML - Is it possible to show value Html.TextAreaFor in Javascript ConfirmBox?
I'm trying to show Value of Html.TextAreaFor in Javascript Confirm Box but 开发者_开发问答my code doesn't work. Maybe somebody has a good idea how to fix it..
This is my code:
<% using (Html.BeginForm())
{ %>
<%= Html.Hidden("ThreadId", Html.Encode(this.Model.ThreadId))%>
<%= Html.TextAreaFor(m=>m.Quote,7,40,null)%>
<br /> <button name="view" value="ViewQuoteButton" onclick="return ViewQuote()">
View
</button>
<% } %>
<script type="text/javascript">
function ViewQuote() {
if (confirm(document.valueOf( "here I'trying to show value of TextAreaFor"))) {
return true;
}
else {
} return false;
}
</script>
Thank you all and take care, Ragims
document.getElementById("Quote").val();
OR
document.getElementByName("Quote").val();
精彩评论