I have a simple html file with a function called add1 and a button. The file includes a separate javascript file. All that file has is 1 function called add2. if I call both add1 and add2 from the main file there is no problem. Everything works as expected. If however I use webix button to call the external function add2, it doesn’t work. i can only call add2. Here is some snipped of code
//main file
<script>
function add1(x, y) {
console.log(x + y);
}
webix.ready(function() {
gridb = new webix.ui({
container : "testB",
view : "button",
value : "ADD",
align : "center",
click : "add(100, 200);", //changing to click : "add2(400, 600);" does not works
width : 200
});
});
</script>
//imported file
function add2(x, y) {
console.log(x + y);
}
In the example above I will see in the console 33 as expected. However, if I change the webix button click line to the external function add2 (click : “add2(400, 600);”, It simply doesn’t work. If however, I put add2(400, 600); inside of add1 this does works. Why??
function add1(x, y) {
console.log(x + y);
add2(1000, 2000); //This works
}