“this” keyword doesn’t seem to work

I am trying to understand how the this keyword works in JavaScript and I made this script:

function click(){
    this.innerHTML="changed";
}

Used in this HTML:

<button id="clicker" onclick="click()" >Click me</button> 

But it doesn't work, can anyone explain why?

5
задан ljs.dev 28 September 2013 в 14:55
поделиться