views:

80

answers:

2

I have a jQuery array acting on each control having corresponding class:

function Foobar() {
   $('.foo').each(function() {
     // do something with $(this)
   }
}

I can access client-side controls like <input class="foo"> and server-side controls like <asp:TextBox CassClass="foo">

But setting CssClass for asp:RadioButton doesn't make a sense. Here is generated code:

<span class="foo">
   <input type="radio" />
</span>

How to set class for inner input or another way gather it using jQuery?

+1  A: 

You can get the inner input type radio elements in many ways, for example you could use the :radio selector:

$('.foo input:radio').each(function () {
  //...
});
CMS
Will it select controls with class="foo" theirself *and* inner controls of them?
abatishchev
It will select the `<input type="radio" />` elements whose have a parent with class `foo`.
CMS
Sunny
`$('.fee').add('.fee input:radio'))` works as I need
abatishchev
+1  A: 
function Foobar(){
 $('.foo input[type=radio]:only-child').each(function(){
   // do something with $(this)
 });
}
Sunny