I have a button with onclick
method which calls function.
What is not clear to me, why is this
inside function seen as Object? Isn't this suppose to be object calling method? In this case it is the button?
I pass only one parameter as this
to the method. And this parameter correctly shows button (named parameter element inside function).
Why is this inside function not showing button inside DOM which called the method?
var test = (function() {
var test1 = {
nameT: 'test'
};
methodTesting(test1);
function methodTesting(element) {
debugger;
}
return {
methodTesting: methodTesting
}
});
<button onclick="test.methodTesting(this);" data-itest=1 data-ctest2='miran' data-ct='feri'>TEst</button>