I apologize for the banal question. There is a “choice” for the built on <input type="radio"> I wanted not only the button itself to be active, but also the text on the right, like there is a label attribute but something without effects.

It is clear that you can set each input its id , and on click to do $('radio1').value.checked() but mb there are other more elegant options?

Example code: http://jsfiddle.net/4YUuP/

    2 answers 2

    It's very simple, thank you for your attention:

     <label><input type="radio">Label 1</label> <label><input type="radio">Label 2</label> <label><input type="radio">Label 3</label> <label><input type="radio">Label 4</label> 

      http://jsfiddle.net/AbvLV/2/

       var oldRadio; $( document ).on( "change", 'input[name=pos1]', function(event) { if(oldRadio)oldRadio.closest('li').removeClass('active'); oldRadio=$(this); oldRadio.closest('li').addClass('active'); }); 

      It is possible without a variable, but then constantly it will be necessary to delete classes for all list items.

      • Dear comrade, you did that when you click on a radio, the text stands out, but I need to select a radio (clicked) when clicking on the text - ferrari
      • Yes, I did not quite understand, clung to the "effects". Thank you for the label - Fantyk