checkbox value javascript code example

Example 1: fill checkbox javascript

// Check
document.getElementById("checkbox").checked = true;

// Uncheck
document.getElementById("checkbox").checked = false;

Example 2: jquery on checkbox checked es6

$("input[type='checkbox']").on('change', (e) => {
      console.log("Checked Value 'is' :: ", e.currentTarget.checked);
 })

Example 3: how to check if input is checked javascript

const cb = document.getElementById('accept');
console.log(cb.checked);

Example 4: html checkbox status

app.innerHTML = '<h1>Hello, world!</h1>';