开发者

How to access repeater items from JavaScript

开发者 https://www.devze.com 2023-01-10 10:09 出处:网络
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:

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

精彩评论

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