Wanneer iemand 'other kiest' en je een textfield wilt laten zien.
Thu Jun 15 2023 11:28:57 GMT+0000 (Coordinated Universal Time)
Saved by
@Amber
<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>
content_copyCOPY
https://chat.openai.com/c/27bf8c3a-a183-4e84-aff6-85d425a92ab4
Comments