create function for click javascript code example
Example 1: button click function in js
<script>
$(document).ready(function(){
$('#MyButton').click(function(){
CapacityChart();
});
});
</script>
<input type="button" value="Capacity Chart" id="MyButton" >
Example 2: how to create click function in javascript
var x = document.getElementById('container');
//click can also be antother event
x.addEventListener('click', function (x) {
console.log('hi');
});