All Questions
563 questions
0
votes
1
answer
71
views
Execute the same javascript function from different onclick events [duplicate]
I have the following javascript code that plays a video when I click the "play" button in HTML.
How can I play different videos (multiple play buttons in HTML) without duplicating the ...
0
votes
1
answer
56
views
Responsive navbar click
I try to get my navbar responsive. Follow this tut on w3schools. If I copy and paste it is working, but I want it to be mobile first (media queries) and there is my problem.
The switch from mobile to ...
1
vote
1
answer
52
views
How to change content in an onclick function for all elements inside a button tag?
I have a layout where if the image and/or text are clicked, then it populates different information below it. If I have an img and paragraph inside the button, it will only work if you click anywhere ...
1
vote
1
answer
105
views
Change CSS of the clicked element
Probably a silly question, but the basic way I learned how to change CSS of something on click is
var x = document.getElementById("id");
x.style.height = "auto";
or whatever....
0
votes
2
answers
350
views
How to use class name to change an element's display?
Let me be frank, I have no idea how javascript works. I was hoping someone could show me how to get this to actually function.
What I'm trying to do is use the element's class name to change it's ...
0
votes
1
answer
77
views
Dropdown menu is losing all styling when .active class is enabled but with on:hover it works
I encountered a strange behavior in a dropdown component and I can not figure out what causes the problem. Any help is really appreciated!
It is a simple dropdown. I used React, CSS and JavaScript ...
0
votes
2
answers
52
views
Have an automatically highlighted button in an a active class script
I've got a list of buttons that change the font family of my text. I wanted to change the border and text color when a certain option was chosen.
I've got this javascript that works well, but when the ...
2
votes
1
answer
111
views
How to have multiple events with a single onclick in javascript
I am veryyy new to this and am trying out a small project while I learn html/css/javascript. So, sorry if this is a fairly obvious question/answer.
Basically, I made my (very simple) site have a dark ...
0
votes
2
answers
114
views
Hide image if another one is opened, vice versa
I'm have code for two images (Image1, Image2) that both open if two other images are clicked, with onclick and a Java part at the end, like so:
<table style="background-color: #ebebeb; border-...
0
votes
0
answers
45
views
Where do onclick() tags look for functions in order?
JS is loaded from seperate file which is working. It is also guaranteed that the element with onclick() is loading after the script as it is created by it. Im not sure where html onclick() looks for ...
2
votes
1
answer
96
views
Keyframe animations with Intersection Observer run unexpectedly when clicking on child elements with onclick
I want css keyframe animations to run 1 time when the bridge element is in the viewport. Intersect observer does this well, but the issue is the animations fire randomly when clicking on other parts ...
0
votes
1
answer
708
views
I need to insert code to an Elementor Pro button that changes its background color on click
I have 13 buttons aligned, whe the user selects one, It must change its background color and remains the same when the user returns from the form that the click event displayed, so the same must be ...
-1
votes
1
answer
47
views
Animate form's label
I am trying to animate my input labels to move up after click the way it works is after clicking on input a class which contains the animation I want is assigned to the label, but it is not working.
...
0
votes
1
answer
2k
views
Clicking a button to show next div?
I have a page with multiple divs. I want there to be buttons that, when clicked on, go to the next div. E.g. Div #1 is visible on the page. It has a 'next' button on it. When the user clicks the next ...
0
votes
2
answers
85
views
playerSelection() is not returning but its getting passed a string value? [Rock paper scissors game]
Hello, i am currently revisiting a rock paper scissors game in html/css/javascript. Now i am trying to make a corresponding website where you can click the button and it logs your playerChoice in that ...