开发者

Search all element IDs on a page using JQUERY

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 %>'");
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜