更改隐藏字段值与jQuery和获得服务器的新值 [英] Change hidden field Value with jquery and get the new value in server
本文介绍了更改隐藏字段值与jQuery和获得服务器的新值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我改变了价值与jQuery的隐藏字段,现在我想在服务器上的新的价值。
我使用asp.net,这是我的jQuery code:
I change value off the hidden field with jquery and now i want to get the new value in server. i use asp.net and this is my jquery code:
$('#HiddenField').val("NewValue");
这是我的HTML标记:
and this is my html tag:
<input id="HiddenField" type="hidden" runat="server" value=""/>
在我的网页我改变'#HiddenField
的价值,我希望得到的NewValue在服务器端。
in my page i change the value of the '#HiddenField'
and i want to get the NewValue in server side.
推荐答案
我想这个我的网页上,
<!DOCTYPE html>
<html>
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Button runat="server" ID="goBtn" Text="Go" OnClick="goBtn_Click" />
<input id="HiddenField" type="hidden" runat="server" value="" />
<asp:TextBox runat="server" ID="testTxt"></asp:TextBox>
</div>
</form>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$('#<%=HiddenField.ClientID %>').val("Test");
});
</script>
</body>
</html>
这在code后面,
and this in the code behind,
protected void goBtn_Click(object sender, EventArgs e)
{
testTxt.Text = HiddenField.Value;
}
在preSS go按钮,新的价值是在服务器上可用。
when you press the go button, the new value is available on the server.
这篇关于更改隐藏字段值与jQuery和获得服务器的新值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文