0
My button don't display my console. I haven't error. Thanks you.
display width img in console. https://code.sololearn.com/WYOzwVTxY9tA/?ref=app
3 Respostas
+ 7
Malick Diagne The code currently prints 100% when I click the button. I'm assuming you added some new code to fix the issue.
That said, I noticed a line that will not work as you think it might.
Specifically, the line is:
button.onclick = "myfunction ()";
Technically, you're assigning a string value rather than a reference to a callback function.
If you had defined a function called myfunction(), then the line above would need to be rewritten as:
button.onclick = myfunction
Notice that the quotes and parentheses were removed. The semicolon is optional.
+ 2
I clicked the button and 100% was displayed in console. Can you describe some more what should happen?
+ 1
console.log(el.width);