Hey guys I am trying to call a function inside a callback function with addEventListener
The code I am using is
<html>
<body>
<table id="outside">
<tr><td id="t1">one</td></tr>
<tr><td id="t2">two</td></tr>
</table>
<script>
function avis(n) {
return n;
}
var c = document.getElementById('outside');
function babe() {
if(this.avis(c) == 'outside') {
console.log('yuck');
}
}
var el = document.getElementById("outside");
el.addEventListener("click", babe, false);
</script>
This above code gives error like Uncaught TypeError: undefined is not a function
.\
But when I use code like:
function babe() {
if(this.id == 'outside') {
console.log('yuck');
}
}
It works fine ..
So my question is... is it possible to call another function with this.functionname()
inside the callback?