在下面的代码中,我有一个隐藏字段。现在我想从特定的隐藏字段中获取值。我尝试了下面的代码,我得到了所有隐藏字段的值。但我想要特定的隐藏字段值。请帮助我要这样做。 JS:
str = "";
$('input[type=hidden]').each(function (){
str+=$(this).val() + "$";
});
if(str != "")
str = str.substring(0,str.length-1);
alert(str);
asp.net
<asp:hiddenfield ID="hide" runat="server"/>
最佳答案
为什么不直接使用隐藏字段的 id 选择器?
$('#hide').val();
关于javascript - 从特定隐藏字段获取值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22257316/