Disabling inputs in Bootstrap based on toggle switch selection?

Reading through the documentation, I’m trying to find a way in bootstrap 5 to disable other input fields if a toggle switch input is set to ‘off’?

Parent element is #member_form, switch is ‘toggleswitch’.

The following will disable the field when anything is the form is clicked. But I’d like to switch from enabled to disabled and back based on the the toggleswitch element?

    $(document).on('click', '#member_form', function(){
        $("#input_name").attr('disabled','disabled');
    });

Any suggestions?