I have an ASP.NET 3.5 page which has multiple span elements with ID containing lblError. How can I get all the span elements whose开发者_如何学Python IDs contain lblError?
$("span[id*='lblError']")
Since you are probably doing this to get around the mangled names created when using server controls you can try a couple of ways.
This will find anything that has lblError in it at the end:
$("[id$='lblError']");
Also, if you know the server control name you can do the following in your aspx page which will find your exact control:
$("#'<%= lblError.ClientID %>'");
精彩评论