I can't figure out how to have a function refer to my button so that I can have my button actually do stuff when I click it. Here is my function:
this.Click = function () {
alert('It works');
}
Here is my button in the return statement:
<button id="button" onClick="Click()">Click me!</button>
Both of these are in a larger function. I keep getting errors about my Click() function and I don't know why!! [EDIT] I'm in a .js file, not an html file
onclickattribute, it must be defined in the global scope. Unlessthisiswindow, the function is not global. In any case, usingaddEventListeneris almost always the better choice.