noob-1 noob-1 - 21 days ago 4x
HTML Question

How to select and check these types of checkboxes based on values?

<span class="answerBox">
<a name="checkboxtag" class="largecheckbox" onclick="selectQuestionAnswer(this);"></a>
<input name="answers" value="8ad6a4124641ec5001464d856b23436c" class="checkbox displaynone" type="radio">

I've tried using .prop()

jQuery('input:checkbox[value="8ad6a4124641ec5001464d856b23436c"]').prop("checked", true);

Tried to just trigger a click:


Tried editing its sibling's class (because on click, it changes the sibling's class and nothing else):


Then I wasn't so sure if I was even selecting it correctly. I tried to toggle highlight on the checkbox but it doesn't do anything..


Is it just not possible to select this checkbox? I've been trying all day yesterday and today.

Thanks for reading and any help!

Edit: you guys are gods. IT WORKS. I used

to just make sure it worked AND IT DOES. THANK YOU.
Then I used trigger('click'); and it did. All I had to do was select it using the radio selector. Thank you everyone for your efforts.


You are trying to change an <input type="radio"> with a checkbox selector

Fix one or the other to what it is supposed to be

Your code works fine when you change to

<input name="answers" value="8ad6a4124641ec5001464d856b23436c" type="checkbox">

If you want to leave as radio use :radio selector