javascript - Change Radio button Item class on selection -


i using razor view engine generate list of radiobutton items using code , css , javascript

    .radioselection {     color: green;     font-weight: bold;         }  $(document).ready(function () {               $("input[name=scoreid]:radio").change(function () {            //how can access label span of current selection & reset old selection               });  });  @foreach (var item in model) {   <li class="radio clearfix ui-sortable-handle">           @html.radiobutton("scoreid", statement_item.id, new { @class = "" })     <span class="lbl" >@statement_item.statement</span>   </li> } 

how can set class radioselection selected radiobuttonlist item , how can reset selection of old item normal when new radio item choosen

use .next() function next element required span

$("input[name=scoreid]:radio").change(function () {       $(':radio:checked').not(this).prop('checked',false)     $('li.radioselection').removeclass('radioselection'); //reset selection      $(this).closest('li').addclass('radioselection');   //add class list item      $(this).next('span')         //access span });