<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>
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter