开发者

How to access repeater items from JavaScript

I've got a hidden control inside a r开发者_JAVA技巧epeater. How can I access this from JavaScript?


Are you using JQuery? This can be easily done by the following:

$("#<%= Repeater1.ClientID %>").find("input[type='hidden']")

Which scours the entire repeater; because each item doesn't render a wrapper around it (a div or a table, for example), the find does an entire check of the HTML tree. Otherwise, you'd have to loop through each element, or wrap each item with a DIV, and access the childNodes collection of that DIV, and it would be more of a pain without JQuery, but very possible.

HTH.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜