Locking the checkbox of a HS form

by nlafakis

HTML

<head>
  <script charset="utf-8" type="text/javascript" src="//js.hsforms.net/forms/v2.js"></script>
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
</head>
<html>

  <body>
    <div id="lp-code-230">
    <div style="position:relative;color:white;margin:4% 0%;">Example 1: Kevin B<br>jQuery Forums</div>
    <hr style="width:60%;">
      <div class="hubform">
        <script>
          hbspt.forms.create({
            region: "na1",
            portalId: "3436466",
            formId: "75cff364-7cfc-4dc4-8a2f-2d7ffa9c3e5a",
            onFormReady: function() {
              $('value').change(function() {
                var value = $(this).val();
                if (value == "Memory Care") {
                  $("input[value='Supervised Independent Living']").prop("disabled", $(this).is(":checked"));
                } else if (value == "Supervised Independent Living") {
                  $("input[value='Memory Care']").prop("disabled", $(this).is(":checked"));
                }
              });
            }
          });
        </script>
      </div>
    </div>
    <div id="lp-code-231">
    <div style="position:relative;color:white;margin:4% 0%;">Example 2: Alex<br>Hubspot Community Forums</div>
    <hr style="width:60%;">
      <div class="hubform">
        <script>
          hbspt.forms.create({
            region: "na1",
            portalId: "3436466",
            formId: "75cff364-7cfc-4dc4-8a2f-2d7ffa9c3e5a",
            onFormReady: function() {
              $(document).on('change', 'value="Memory Care"', function() {
                if($('value="Memory Care"').prop('checked')){
                  $('value="Supervised Independent Living"').attr('disabled', true);
                  $('.hs-input').css('opacity', 0.6);
                } else {
                  $('value="Supervised Independent Living"').attr('disabled', false);
                  $('.hs-input').css('opacity', 1.0);
                }
             ...

CSS

@import url(https://fonts.googleapis.com/css?family=Montserrat:100,100i,200,200i,300,300i,400,400i,500,500i,600,600i,700,700i,800,800i,900,900i);

* {
  font-family: 'Montserrat', 'Helvetica', 'Verdana', sans-serif;
}

#lp-code-230 {
  position: relative;
  float: left;
  text-align:center;
  width: 360px;
  z-index: 99;
  height: auto;
  overflow: auto;
  margin: 0px 2%;
  padding: 0px;
  background: #603373;
  background: -webkit-linear-gradient(to top left, #603373 0%, #643578 25%, #6F3B85 50%, #633575 75%, #5B306B 100%);
  background: -moz-linear-gradient(to top left, #603373 0%, #643578 25%, #6F3B85 50%, #633575 75%, #5B306B 100%);
  background: linear-gradient(to top left, #603373 0%, #643578 25%, #6F3B85 50%, #633575 75%, #5B306B 100%);
  border-radius: 3px;
  border: 1px solid #B8B8BF;
  /* box-shadow: 0px 0px 8px 0px rgba(0, 0, 0, 0.1); */
}

#lp-code-231 {
  position: relative;
  float: left;
  text-align:center;
  width: 360px;
  z-index: 99;
  height: auto;
  overflow: auto;
  margin: 0px 2%;
  padding: 0px;
  background: #603373;
  background: -webkit-linear-gradient(to top left, #603373 0%, #643578 25%, #6F3B85 50%, #633575 75%, #5B306B 100%);
  background: -moz-linear-gradient(to top left, #603373 0%, #643578 25%, #6F3B85 50%, #633575 75%, #5B306B 100%);
  background: linear-gradient(to top left, #603373 0%, #643578 25%, #6F3B85 50%, #633575 75%, #5B306B 100%);
  border-radius: 3px;
  border: 1px solid #B8B8BF;
  /* box-shadow: 0px 0px 8px 0px rgba(0, 0, 0, 0.1); */
}

.hubform {
  position: relative;
  width: 90%;
  margin: 6% auto;
  padding: 0px;
}

@font-face {
  font-family: 'Registered Trade Mark Sign';
  src: local('Times New Roman');
  unicode-range: U+000AE;
}

JavaScript

$(document).on('change', 'input[name="Memory Care"]', function() {
  if($('input[name="Memory Care"]').prop('checked')){
    $('input[name="Supervised Independent Living"]').attr('disabled', true);
    $('.hs-input').css('opacity', 0.6);
  } else {
    $('input[name="Supervised Independent Living"]').attr('disabled', false);
    $('.hs-input').css('opacity', 1.0);
  }
});

$(function() {
  enable_cb();
  $("#group1").click(enable_cb);
});

function enable_cb() {
    if ($('#group1').is(':checked')) {
        $('.group1').attr('disabled',true).removeAttr('checked');   
    }
    else {
        $('.group1').removeAttr('disabled');
    }
}

$(function() {
$('input').change(function() {
var value = $(this).val();
if (value == "Memory Care") {
$("input[value='Supervised Independent Living']").prop("disabled", $(this).is(":checked"));
} else if (value == "Supervised Independent Living") {
$("input[value='Memory Care']").prop("disabled", $(this).is(":checked"));
}
});
});