检索使用jQuery服务器控件的ID [英] retrieve ID of server control using jQuery
本文介绍了检索使用jQuery服务器控件的ID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我如何使用jQuery的服务器控件的ID?
例如。我有
< ASP:标签ID =LABEL1=服务器>< / ASP:标签>
现在我想要得到LABEL1
VAR ID =?
解决方案
如果您使用ASP.NET 4.0,你可以设置属性的ClientIDMode =静态和你的code将按照以下方式长相:
< ASP:标签ID =LABEL1=服务器的ClientIDMode =静态>< / ASP:标签>
JS:
VAR ID ='LABEL1';
How do I get the ID of a server control with jQuery?
E.g. I have
<asp:Label ID="label1" runat="server""></asp:Label>
and now I want to get "label1",
var id = ??
解决方案
If you use ASP.NET 4.0 you can set attribute ClientIDMode="Static" and your code will looks following way:
<asp:Label ID="label1" runat="server" ClientIDMode="Static"></asp:Label>
js:
var id = 'label1';
这篇关于检索使用jQuery服务器控件的ID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文