[英]Pass value of textarea when submit button is clicked
<textarea id="Comment" type="text" runat="server" rows="7"
maxlength="2000" />
<input id="SubmitComment" type="button" value="Submit"
onclick="SubmitButton()" />
當用戶將數據輸入textarea並單擊“提交”按鈕時,我希望將數據傳遞給submitButton(),然后我可以將其發送到Functions.CommentBoxForInvoiceUpdates
function SubmitButton() {
var commentBoxData = $('#Comment').val();
Functions.CommentBoxForInvoiceUpdates(id, Labour, commentBoxData);
}
Id和Labor之前已定義,因此它們可以正常工作,但是當我通過斷點運行時,'CommentBoxData'顯示為未定義。 單擊提交時發送評論框中的數據的原因是什么?
謝謝你的任何想法
你用asp.net標記了。 當然你使用渲染的ID?
嘗試
var commentBoxData = $('#<%=Comment.ClientID%>').val();
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.