How to define two different function based on event click?
JS Fiddle: https://jsfiddle.net/k140nad9/6/ HTML Code below: <input type="checkbox" id="btnA" onchange="openFunctionA();"> FUNCTION A </input> <input type="checkbox" id="btnB" onchange="openFunctionB();"> FUNCTION B </input> <div id="map"> MAP </div> And this JS Code: var map = document.getElementById('map') var btnA = document.getElementById('btnA') var btnB = document.getElementById('btnB') function openFunctionA() { if($('#btnA').is(":checked")){ $('#btnB').attr('disabled', true) map.addEventListener('click', function(e){ alert("THIS FUNCTION A") }) } else {