Let's say i have a button. <input type="button" value="Click me" onClick="MyFuncion()">
In the function, I want to get the button object.
I tried the following:
function MyFunction()
{
this.value = "Another text";
}
<input type="button" value="Click me" onClick="MyFuncion()">
My intent was changing the button's text to something another text.
As you can see, this
isn't pointing to the button. My guess is that it is pointing to the function itself.
How do i do this?
In a few words, my question is: How do i get the object that called a function?