Monday, February 10, 2014

JQuery Selector for ASP.NET server side control

I can't remember how many times I googled over this small snippet. Better save it somewhere we all can access.


  • $('#<%=ServerSideControl.ClientID%>') will find an element with the id attribute as supplied by theClientID property in ASP.Net.


  • $("[id$=ServerSideControl]") will find an element with an id attribute that ends with lblName, for examplefoo-lblName.