Skip to content
Advertisement

Tag: button

HTML onclick event doesn’t work with parameter

When I click my button, which should make things visible and invisible, the whole website disappears. What I was trying to do is to make a div with some text and probably some images and let it disappear and appear, when the button gets hit. So it would look like the Information box lists more information’s, when the user wants

Start/Stop button not working as expected

I have recently started learning JavaScript, and I’d like to make a button, with a function, which changes the innerHTML on click. On the first click it changes the text, but after that nothing. Any ideas how could I fix that? Here is the code so far: Answer You have to set the turnedOn flag outside of the click method,

I want to fix clicking menu button problems

To hide the menu when I click on windows or scroll, I tried like this. My html is like this. And css is like this. If you try this code, you can find when you click window once, then the button doesn’t work. When I click windows once, dropdown showed when I click the button twice. I want to solve

Execute Javascript code on HTML button click

I’m currently making an eshop. I use cookies to store the shopping cart. This is my HTML button: And when the user clicks this button I want to execute the following Cart.js code, which simply creates a cookie and add the product id to cookie cart. My problem is that when I click the button it takes no action. What

JavaScript Show invisible divs on click

I ran into a problem that when I click on the button, it just flips the icon but only makes the invisible fields visible on the second click. Are there any idea how to do it? (Heres a gif to show my problem: https://ibb.co/cvz7pWC ) Also heres my code : Answer This could be to do with you not being

Button that generates error message on condition

I am trying to implement a button in HTML that calls a function on click, which checks whether a textinput is empty. If so (the information hasn’t been entered), an error message for the input field should be generated. I am experimenting with a button that doesn’t submit the form. However, if you have a solution with a button that

How do I get a Javascript button on second click to change class on self and *sometimes* on other buttons containing same class

I am attempting, with my very limited Javascript knowledge, to write vanilla Javascript to some buttons to achieve the following: a) Click any button, e.g. button1 and its content is displayed b) Click the same button and its content is hidden c) Click a button again (e.g. button1) and then click another button (e.g. button2) and button2 content is displayed

Advertisement