Search code examples
javascriptjqueryasp.netradiobuttonlist

How to select an element according a value


HowI can select an element according a value? for example I want to select an input in RadiobuttonList control that has value=2.

thanks


Solution

  • $('#{id of RadiobuttonList} input[value="2"]').attr('checked', 'checked')
    

    or for jQuery 1.6+:

    $('#{id of RadiobuttonList} input[value="2"]').prop('checked', true)