JSFiddle - React, Tailwind, and code Playground

by seankoole

HTML

<div id="edit-horses-riding-items-0-item-entry-extras" class="js-webform-checkboxes webform-options-display-one-column form-checkboxes">
  <div class="form-item js-form-item form-type-checkbox js-form-type-checkbox form-item-horses-riding-items-0--item--entry-extras-a3e3g0000004ugjuaa js-form-item-horses-riding-items-0--item--entry-extras-a3e3g0000004ugjuaa checkbox">

    <label for="edit-horses-riding-items-0-item-entry-extras-a3e3g0000004ugjuaa" class="control-label option">

      <input data-drupal-selector="edit-horses-riding-items-0-item-entry-extras-a3e3g0000004ugjuaa" class="form-checkbox" type="checkbox" id="edit-horses-riding-items-0-item-entry-extras-a3e3g0000004ugjuaa" name="horses_riding[items][0][_item_][entry_extras][a3E3G0000004ugjUAA]" value="a3E3G0000004ugjUAA">

      Extra Hay (£12.00)</label>


  </div>
  <div class="form-item js-form-item form-type-checkbox js-form-type-checkbox form-item-horses-riding-items-0--item--entry-extras-a3e3g0000004xsiuaq js-form-item-horses-riding-items-0--item--entry-extras-a3e3g0000004xsiuaq checkbox">

    <label for="edit-horses-riding-items-0-item-entry-extras-a3e3g0000004xsiuaq" class="control-label option">

      <input data-drupal-selector="edit-horses-riding-items-0-item-entry-extras-a3e3g0000004xsiuaq" class="form-checkbox" type="checkbox" id="edit-horses-riding-items-0-item-entry-extras-a3e3g0000004xsiuaq" name="horses_riding[items][0][_item_][entry_extras][a3E3G0000004xsIUAQ]" value="a3E3G0000004xsIUAQ">

      Start Fee (£17.00)</label>


  </div>
  <div class="form-item js-form-item form-type-checkbox js-form-type-checkbox form-item-horses-riding-items-0--item--entry-extras-a3e3g0000004xtbuaq js-form-item-horses-riding-items-0--item--entry-extras-a3e3g0000004xtbuaq checkbox">

    <label for="edit-horses-riding-items-0-item-entry-extras-a3e3g0000004xtbuaq" class="control-label option">
      <input data-drupal-selector="edit-horses-riding-items-0-item-entry-extras-a3e3g0000004xtbuaq"...

JavaScript

var $checkbox = $('label:contains("Test")').find(':input[name*="\[entry_extras\]"]');

  $checkbox.attr('checked', true)
    .attr('disabled', true);