Question

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.

Was it helpful?

Solution

You can check if there is no multiple radio buttons with same name and value on the document

OTHER TIPS

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);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top