简体   繁体   中英

How to access repeater items from JavaScript

I've got a hidden control inside a repeater. 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM