Questions tagged [onclick]
An event which occurs when user clicked an object. It is a combination of two events, that is, "onmousedown" and "onmouseup".
onclick
14,680
questions
0
votes
0
answers
15
views
Incorrect click coordinates for events caused by react onClick handler
I'm seeing weird behavior with react onClick handlers when device emulation mode is turned on in Chrome (and also in my own capacitorjs apps running on an Android device).
Essentially, clicks right ...
0
votes
0
answers
7
views
An event listener using named function with arguments of element id's and then remove event listener upon completion of task [duplicate]
I was making a tic tac toe using JS . It came out fine but even after a player wins it still let us mark down the empty boxes. So i tried to enclose the main program into a named function and passed ...
-1
votes
0
answers
33
views
How can I export click event callbacks that use React state from within a component?
I'm building a Dashboard to visualize a few NLP experiments.
Here's a snippet from the Dashboard component (.tsx) I've currently written:
import { Dispatch, SetStateAction, useEffect, useState } from &...
-6
votes
1
answer
40
views
How do you increment a number made with an onclick (in html)? [closed]
function incrementValue() {
var value = parseInt(document.link('number').value, 10);
value = isNaN(value) ? 0 : value;
value++;
document.link('number').value = value;
}
<div class="link"&...
0
votes
2
answers
47
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
28
views
How can I display single quotes instead of the HTML entity when adding onClick events to WordPress menu using nav_menu_link_attributes?
I like to add a class and an onClick event to a single WordPress menu link.
My code is based on an example given by WordPress here:
function add_specific_menu_atts( $atts, $item, $args ) {
$...
0
votes
0
answers
30
views
Adding style property to individual class elements on click, IF their data is modified
I'm trying to make a browser dress up game with separate tabs for draggable items (so tops, bottoms, etc). This is the JavaScript code for how the tabs function.
function openTab(event, Category) {
...
1
vote
1
answer
52
views
TypeError: props.signIn is not a function
I'm developing a React application where I've implemented a login form using styled-components and Redux for state management. The login form includes a Google sign-in button (Google styled component) ...
-1
votes
1
answer
40
views
im trying to run some very basic javascript on a click event and im getting an undefined function error
<script>
function x() {
console.log("thisWorks")
}
</script>
<button onclick="x()"></button>
my hopes were that clicking the button would trigger the console ...
0
votes
1
answer
133
views
What's the recommended way to click away from a dialog with Playwright?
I'm writing a web app that uses Mantine's <Modal> dialog component. The modal shows an overlay on the background when opened. Clicking on the overlay causes it to close.
I am trying to write a ...
1
vote
3
answers
65
views
Make buttons to switch between 12 and 24 hour time that saves to localstorage
I have a clock in my website, and I would like to add a button or switch into settings that switches the time from 12 hour and 24 hour and vice versa.
My problem is that I have no idea where to ...
0
votes
0
answers
31
views
How to link to marker on Leaflet map from another URL
This works perfectly for activating a popup on a leaflet map on the same page:
{<a class="mplk" href="#where" onclick="t5.fire('click')">See on map</a>}.
The ...
-1
votes
1
answer
38
views
find div in repeater when onclick
My friends, I want to change the class of a tag div in on click button (asp.net), but that div is inside the repeater, how can I find it? and change class?
Actually, I want to change bootstrap column ...
0
votes
1
answer
41
views
How to change state on individual parts of a mapped arrray in React
I've got a mapped array thats set up to look like playing cards. When I click on them I need them to 'flip'. Right now my onclick 'works' and the state/property goes from 'faceup' to 'facedown' but it ...
0
votes
1
answer
39
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 ...