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

26th Jul 2021, 5:49 PM
Malick Diagne
Malick Diagne - avatar
3 Réponses
+ 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.
26th Jul 2021, 8:19 PM
David Carroll
David Carroll - avatar
+ 2
I clicked the button and 100% was displayed in console. Can you describe some more what should happen?
26th Jul 2021, 5:59 PM
Lisa
Lisa - avatar
+ 1
console.log(el.width);
26th Jul 2021, 6:14 PM
Solo
Solo - avatar