<!--Creating Checkbox and para -->
<center style="font-size:40px; " >Click this Box <input type="checkbox" id="myCheckbox">
<p id="myPara"></p></center>
input{
width: 30px;
height: 30px;
}
//Get reference by ID to the input and para element
const checkBox = document.getElementById('myCheckbox');
const Para = document.getElementById('myPara');
//Add the change event for checkbox
checkBox.addEventListener('change', () => {
Para.innerHTML = "The checkBox is :"+ checkBox.checked; // display the current change of checkbox
});
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.