retrieve ID of server control using jQuery

前端 未结 6 1231

How do I get the ID of a server control with jQuery?

E.g. I have

a

6条回答
  •  时光说笑
    2020-12-11 05:40

    var labelID = $('#<%= label1.ClientID %>');
    

    You need to get the client ID.

    If you just need the ID, and not the actual value of the control, then you don't even need jQuery.

    var labelID  = '<%= label1.ClientID %>';
    

提交回复
热议问题