html checkbox change value javascript code example

Example 1: checkbox change event javascript

document.getElementById('one').addEventListener('click', function(){
  var two = document.getElementById('two');
  two.checked = ! two.checked;
  two.dispatchEvent('change');
});

Example 2: js html textbox on change

<!-- 
	You can use any of the following:
	onkeydown, onkeyup or onchange
 -->

<input type="text" onkeydown="keydownFunction()" 
onkeyup="keyupFunction()" onchange="changeFunction()">