Access asp:CheckBox inner input from jQuery

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?

Answers


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 () {
  //...
});

function Foobar(){
 $('.foo input[type=radio]:only-child').each(function(){
   // do something with $(this)
 });
}

Need Your Help

Splitting one DB association into several collections in Hibernate

java hibernate collections mapping

I am trying to model such situation - there is a cash transfer (I mean a car that carries money), that has required amounts of each currency, and also an actual amount for each currency. And it see...

Trouble in reading values from parsed XML data using XML::Simple

xml perl parsing xml-simple

I am half way through writing a script using XML::Simple. I have read that is not so "simple", and even its own documentation discourages its use in new code, but I have no other choice as this scr...