Skip to content
Advertisement

Tag: button

Is there a way to set the first element in this .map method to a default class on load?

I am currently rendering three buttons using a .map method in React. The buttons are being pulled from an array in a useState. When clicked, the buttons have a .active class added to them. How can I set the first element to have the .active class when the page is first loaded? Current Code: https://codesandbox.io/s/recursing-lake-oetxj?file=/src/App.js Tried setting the first activeObject

Loading spinner disables HTML5 required attribute

I have submit button (bootstrap) where i submit some data from input fields to my PHP query. I have added to this submit button a loading spinner after the button has been clicked by the user. Since i have added the spinner id to the button the HTML attribute for “required” is not longer working. It does not indicate the

What is the best way to make these buttons insert specific text into a text field?

I’ve made a virtual keyboard that has Russian characters and Latin characters. I want to make each character key on the virtual keyboard (.keyLetter) insert the Russian character (.primary) into the text field. Additionally, I want to make each physical keyboard keypress activate the corresponding buttons onscreen, so that the user can type by clicking the onscreen keys, or by

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 functionality, and never had an issue. Code is below:

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. https://jsfiddle.net/gypw370q/ Answer You need set

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

Advertisement