Skip to content

Tag: button

Why is there an error with onclick function?

I’m working on an assignment that asks us to use Promise, and when I run the script, I am getting this error on line 37: Uncaught TypeError: Cannot set property ‘onclick’ of null I can’t understand why the onclick is throwing this error, because I have used buttons before with similar …

Prevent clicking on the black border

Clicking on the black border turns it on. The button part is the middle part. What would be changed in the code to have only the middle part be clickable? Multiple buttons. https://jsfiddle.net/pc47hwgd/ I was able to do it when there is only 1 button, but not when there are multiple buttons on the screen. ht…

Button value output in console.log with JS

I’m fairly new to HTML and JS. I need the value of my HTML button to show in the console.log with JS. I dont want to use onclick=”…” though. This is part of my HTML file: This is my JS file: Answer 1) You have to add event listener on the html element not on the value of that element.

“Button” shrinking after applying JS function

I am trying to build a timer. I am in the process of coding the play and reset button. It seems to work well, except that the “button” for the play or reset button would shrink after I clicked it once, and a refresh is needed to make it the original size again. I have tried to see if there