1var element = document.getElementById("elem");
2element.onclick = function(event) {
3 console.log(event);
4}
1// Create variable for what you are trying to click
2let button = document.querySelector("#IDofItem");
3
4// Click the button
5
6if (button) {
7 button.click();
8}
9else {
10 console.log("Error");
11}
1<script>
2 $(document).ready(function(){
3 $('#MyButton').click(function(){
4 CapacityChart();
5 });
6 });
7</script>
8
9<input type="button" value="Capacity Chart" id="MyButton" >
1<button onclick="myFunction()">Click me</button>
2
3<p id="demo"></p>
4
5<script>
6function myFunction() {
7 document.getElementById("demo").innerHTML = "Hello World";
8}
9</script>