<label> <input type="checkbox" name="options[]" value="other"> Other </label> <input type="text" name="otherText" id="otherText" placeholder="Specify other option" style="display: none;"> <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script> <script> $(document).ready(function() { $('input[name="options[]"]').on('change', function() { if ($(this).is(':checked') && $(this).val() === 'other') { $('#otherText').show(); } else { $('#otherText').hide(); } }); }); </script>