Monday, November 5, 2012

Looping through controls with Jquery

I had a situation where components were being created by a custom control inheriting a repeater - the repeater had a dropdown and was being propogated multiple times but always ended with "blah" in the name - the issue was setting all the dropdowns under certain conditions. this is how I did it:


 onClick ='$("[id$=blah]").each( function() { if (this.options[1].value== "whatever"  && this.selectedIndex ==0 ){ this.options[1].selected = true }   ;}      );'

No comments:

Post a Comment