JSFiddle - React, Tailwind, and code Playground
HTML
<input type="checkbox" id="checkbox1" /> <br />
<input type="text" id="textbox1" />
JavaScript
$(document).ready(function() {
//set initial state.
$('#textbox1').val($(this).is(':checked'));
$('#checkbox1').change(function() {
$('#textbox1').val($(this).is(':checked'));
});
$('#checkbox1').click(function() {
if (!$(this).is(':checked')) {
var answer = confirm("Are you sure?");
if (answer){
}
else{
}
}
});
});