Is it possible to use arrow function as I have on the first button's (aBtn1) onclick event handler? Can someone please explain why the first approach fails?
<script>
var arrFunc = () => {
console.log('test btn clicked');
};
</script>
<form>
<label for="name">Name</label>
<input type="text" value="" id="name" />
<input type="button" name="aBtn1" value="Test" onclick="() => { console.log('test button clicked'); }" />
<input type="button" name="aBtn2" value="Test" onclick="arrFunc();" />
<input type="submit" value="Submit" />
</form>