Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个像这样的隐藏领域
<asp:HiddenField ID="hfprdid" value="hooray" runat="server" />
我正在尝试从这样的 jquery 文件中访问它的值
alert($("#'<%=hfprdid.ClientID %>'").value);
但这会引发这样的错误
Error: Error: Syntax error, unrecognized expression: #'<%=hfprdid.ClientID %>'
尝试删除双引号并更改为单引号
alert($('#<%= hfprdid.ClientID %>').value);
尝试:
alert($("#<%= hfprdid.ClientID %>").val());