You can check if there is no multiple radio buttons with same name and value on the document
I am selecting a radio button using javascript but radio button is not highlighting
-
23-07-2023 - |
質問
I have a group of radio buttons which i am displaying in rows. In this groups i am selecting any 1 radio button using jQuery
but not able to highlight it yet it acts like it is selected as checked="checked" in HTML
while firebugging
.
Need Help!
$('input[type=radio][value='+ value + ']').attr("checked","checked");
OR
$('input[type=radio][value='+ value + ']').prop("checked",true);
I tried both above.
note i am not using a <form>
element.
解決
他のヒント
You can use .prop()
for this
$('#CheckboxID').prop('checked', true);
You can also use .attr()
too
$('#CheckboxID').attr('checked','checked');
Please try this,
$("input[type='radio'][value='"+ value + "']").prop("checked",true);
所属していません StackOverflow