Radio button checked by value

Safaetul Ahasan
Nov 11, 2020
var value = 5;
$("input[name=mygroup][value=" + value + "]").attr('checked', 'checked');
Since jQuery 1.6, you can also use the .prop method with a boolean value (this should be the preferred method):$("input[name=mygroup][value=" + value + "]").prop('checked', true);$('input:radio[name="trainernames"][data-value="One"]').prop('checked',true);

--

--