lundi 3 octobre 2016

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">
</span>

I've tried using .prop()

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

Tried to just trigger a click:

jQuery('input:checkbox[value="8ad6a4124641ec5001464d856b23436c"]').trigger('click');

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

jQuery('input:checkbox[value="8ad6a4124641ec5001464d856b23436c"]').siblings('.largecheckbox').trigger('click');

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..

jQuery('input:checkbox[value="8ad6a4124641ec5001464d856b23436c"]').siblings('.largecheckbox').toggle('highlight');
jQuery('input:checkbox[value="8ad6a4124641ec5001464d856b23436c"]').toggle('highlight');

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

Thanks for reading and any help!




Aucun commentaire:

Enregistrer un commentaire