Questions tagged [onclick]
An event which occurs when user clicked an object. It is a combination of two events, that is, "onmousedown" and "onmouseup".
14,062
questions
0
votes
0
answers
3
views
I want to add back option in multiple inquirer list
Below is the code for reference. I want to set a back option for the previous menu or it is possible to set Ctrl + c for the previous menu.
Any help would be appreciated.
Thanks in advance.
Python ...
0
votes
0
answers
17
views
How to add user inputs on button click
Self taught coder here. Hopefully I can explain this problem adequately. The desired output is to have a button that, when clicked, will create another div that has user inputs. I have a website that ...
0
votes
3
answers
31
views
click twice on checkbox to update state
I am mapping through this array
array=[
{'id': 1, 'isActive': true, 'name': apple},
{'id': 2, 'isActive': false, 'name': orange},
{'id': 3, 'isActive': false, 'name': forest}
]
I have ...
0
votes
1
answer
25
views
React JS onClick() Sometimes doesn't work
I have been trying to fix this for hours. I found this issue originally on iOS for a website I had released. I have tested with the following code, and it will work 90% of the time, but randomly will ...
0
votes
0
answers
23
views
Trying to save value in local storage
function mySystem() {
const prefersDark = window.matchMedia('(prefers-color-scheme: dark)');toggleDarkTheme(prefersDark.matches);prefersDark.addListener((mediaQuery) => toggleDarkTheme(mediaQuery....
1
vote
1
answer
26
views
Error: Expected `onClick` listener to be a function, instead got a value of `object` type
I am implementing a modal in my react app but face the weird error, Error: Expected `onClick` listener to be a function, instead got a value of `object` type.. What's confusing here is the fact that I ...
0
votes
1
answer
36
views
Color table's row on click using Javascript and CSS
I have a table and I would like to color a row on click using Javascript.
Here is my code, there are three rows in the table, two functions in javascript and one CSS file :
function changeColor() {...
0
votes
1
answer
20
views
Why on my react web the anchors of social media does not works propertly , and a misterious details it works just when user reload the page?
When user click, it does not open nothing and once reload the browser the
anchor open the url social media and all is fine until user navigate to other
page and come back again to Contact ...
1
vote
0
answers
28
views
Why is ASP.NET Core stripping out onclick tag/event in a partial view?
This is driving me up the wall - any help much needed and appreciated.
I have a partial view _Policies.cshtml with a button that has an onclick tag that calls the JavaScript function ...
0
votes
0
answers
38
views
how to make a clicker on time in JAVA
Not understand WHY SCHEDULE underline always and not working ( I tried separated into classes, same thing, just can't get where the problem is.
I tried to modify the code using the following solution ...
0
votes
1
answer
17
views
appendChild onclick will only add div once
I'm doing a timetable and to do list website. So, I basically add divs for each timetable block. I've used this tutorial on yt (https://youtu.be/MkESyVB4oUw) for the timetable blocks. (At 24:03) So in ...
0
votes
0
answers
13
views
i can't make a button work, i've tried the eventListener and the onclick [duplicate]
please if someone would be so kind and help me, i would be very happy, clearing i'm a beginner so help if you can, please.
the html
<div>
<h2>TO-DO LIST</h2>
<input type=&...
0
votes
1
answer
37
views
How to hide onclick event using pure JavaScript?
When I was exploring StackOverflow's code, I get:
And I tried to get onclick event handler. There are the report:
> $0.onclick
< null
> $0.parentElement.onclick
< null
But $0.click() ...
2
votes
1
answer
29
views
Save item variable with Button Click
I want to create a web app which displays a number of customers from an API, and when I click on a customer, additional information for that customer will be shown.
So far I've fetched my API data as ...
0
votes
0
answers
31
views
My image is not changing to another image in React on a darkmode click handler
Converting a vanilla javascript file to react and I'm trying to get an image to change when the dark mode button is clicked I'm having trouble getting it to work in React do I use onClick or onChange ...
0
votes
0
answers
8
views
How to make click to select a image file for further backend use
I am making a website of greeting cards.
And i am stuck on how to automatically select the card when clicked on it to select it and do further editing on next page.
-1
votes
1
answer
55
views
Onclick function changes value
I want an easy way to set a variable value equal to n when function(n) runs.
<a href="products.html" onclick="loadProdType(0)">Hovedkort</a>
<a href="products....
0
votes
1
answer
38
views
How can I turn my navbar links into a dropdown menu with HTML CSS and JavaScript?
I am trying to turn the first two links of my navbar into dropdown menus. I want to make it so that when you click on them, the dropdown menu shows and the arrow icon turns from a downward pointing ...
0
votes
1
answer
23
views
button only clicks once, at one div element
this is the onclick function
export function changeColorButton() {
document.getElementById("friendDiv").style.background = "grey";
}
this is the output file. I want every button ...
-3
votes
1
answer
34
views
How to call more than one function in javascript onclick event? [duplicate]
<Button onClick={(e)=>setId(_id); handleDelete()}>Delete
I tried this way, but it gives error.
0
votes
0
answers
29
views
How to call a function on a RecyclerView Item click [android]
I did an OnClickListenner on RecyclerView Item in the ViewHolder class
Item = small card + big card
like that
init {
itemView.setOnClickListener {
if (prod_cardL.visibility=...
1
vote
1
answer
22
views
can't click() an onclick element with selenium (tried text link, partial text link, xpath, css selector)
I need to scrap some data from this url:
https://www.cnrtl.fr/definition/coupe
The data/results I need to scrap are located in those 3 different tabs:
I'm unable to click on the onclick element which ...
0
votes
3
answers
29
views
Oracle APEX - Put onclick event on tabs of tabs container
I've got a tabs container with three tabs. They have select lists and checkboxes on them which have sql queries as source. Users can select entries in the lists or edit the checked boxes and save this ...
-1
votes
0
answers
32
views
React onClick a links not working how do I make them work?
Im trying to create links in my homepage to my other pages that do not use Router. My links work in the app but when Ive transferred them to the homepage and they're not working. The error says I need ...
1
vote
2
answers
33
views
Create helper function for a (click handler) function to reuse in multiple React components
For a 'back' button I've created below (onClick) handler function in my React app.
const { length: historyLength, goBack, replace } = useHistory();
const handleBack = () => {
if (...
0
votes
0
answers
19
views
I want to hide div if user click on dot icon and wanna show other div instead of first one
I want to hide div if user click on dot icon and want to show other div instead of first one.
Please look at this website section image i want to hide this div on click if user click on dot icon.I ...
0
votes
1
answer
23
views
Button onClick in MUI Datagrid invoked without clicking
I implemented a button inside the MUI v5 Datagrid. Based on the official sample https://mui.com/x/react-data-grid/columns/#render-cell , I added the onClick in the Button.
The onClick function was ...
0
votes
0
answers
28
views
Wait for user click then continue execution in React
I am making React Card game with hooks and all that. But I can't figure out how to implement wait for user click when certain condition is met (when is turn on human player for example). I need it to ...
0
votes
0
answers
31
views
How to develop Clickable points within a chart which pop up a dialog box for user entry
I have a set of large number of X & Y coordinates in a dataset to generate a graph or a chart. Let us say that I generate a chart using this dataset. I do not have the code for the chart yet, ...
2
votes
2
answers
61
views
Toggle dark mode - Problem with newly created elements
I want to make JS dark mode toggle with click event but it works
with HTML elements but it doesn't work with created elements with JavaScript using DOM.
let body = document.querySelector(`body`);
...
-1
votes
1
answer
25
views
JavaScript I can't send string parameter to function even I can send int parameter with div.innerHTML on click event
script type="text/javascript">
function QueryAgain(teammate){
document.getElementById("researcher-name").value=teammate;
document.getElementById("publication-name")....
0
votes
2
answers
17
views
Cannot add to list of items in ReactJS
Its been a while since I used ReactJS and I need to create a list of items that I can add to and remove. I've added an onClick event to my li to remove it. I also have a button to add new items, these ...
0
votes
1
answer
25
views
React JS - Expected `onClick` listener to be a function, instead got a value of `string` type
I'm struggling to understand why my onClick function is returning me an error? The functionality is working as expected but throws the following console error:
Expected onClick listener to be a ...
0
votes
4
answers
39
views
Getting Value/Text From Select/Dropdown List
I've Searched The Web So Much But For Some Reason, My Code = No Work;
My JavaScript:
let a = document.getElementById("a");
let b = document.getElementById("b");
let c = document....
-4
votes
3
answers
35
views
how to wait for user to click then console log variable
So right now I am having some trouble with the async/await functions and my goal is to update a variable when the user clicks a button. After this is done then I console log the updated variable. For ...
2
votes
2
answers
53
views
JavaScript: OnClick with multiple elements return "windows" under this keyword
I am trying to bind all <a> elements to have onclick function. And while variable a is a, when I try to use keyword this inside of onclick it returns me Window object.
Code:
<!DOCTYPE html>...
2
votes
1
answer
44
views
'addEventListener' and 'onclick' working only on 'window' Element and NOT any other Element(such as button)
I am trying to make Snakes and Ladders Board game in JavaScript and trying to add 'onclick' or 'addEventListener' events to the buttons of the game. But when I am trying to add them to my buttons ...
0
votes
1
answer
47
views
Calling canvas.scale() doesn't scale the click listener area of the views
I have a bunch of Buttons in a LinearLayout. In the LinearLayout, I override onDraw() to call canvas.scale(scale, scale) where scale is some number. The buttons in the LinearLayout scales visually but ...
0
votes
0
answers
30
views
How to create a button on a different activity programmatically and save it on this activity?
I wanted to create a button on Homepage activity by clicking the button on GroupSettings activity. However, when I do so, and go back to Homepage, the button is not saved on the page.
Here is the java ...
0
votes
1
answer
37
views
How can I select the item from the search dropdown and have it populate the search input field
If you type a word into the search input field a suggestion list appears below.
I would like to be able to select the word from the list e.g Maine (ME) and have it then populate the search input ...
-1
votes
2
answers
61
views
How can I increase and decrease the quantity in reactjs?
I have a button and an input form. When clicking the button, my product quantity decreases by 1 and increases quantity when submitting the form. Quantity increases with the form value. How can I ...
0
votes
0
answers
28
views
What is the best way to call a function and render a child component onClick in React?
I have the below code, I want to call a function and render a child component onCLick. What is the best way to achieve this?
import AddOrder from './AddOrder'
return (
<Button onClick={...
0
votes
1
answer
23
views
Simple onclick event not triggering on Android devices
I have some simple HTML displaying a calendar as below. Once rendered the calendar has either 5 or 6 rows relative to the number of days in the month and which day of the week the 1st of the month is. ...
0
votes
0
answers
15
views
When I add <Link></Link> component Layout's SelectedKeys is not working
Here is my *Navbar
import React, { useState } from "react";
import { Layout, Menu } from "antd";
import {
MenuUnfoldOutlined,
MenuFoldOutlined,
UserOutlined,
...
1
vote
1
answer
20
views
How to replace onclick with eventlistener for sidebar navigation
How would I replace onclick with eventlistener in order to make my collapsible sidebar work. Right now the sidebar does not work in one click (when I add the other onsite links to the navigation- and ...
0
votes
0
answers
7
views
How to have an on click event with a dynamically added checkbox
I'm trying to add an on click event with an event i'm adding dynamically. Each button has a different ID based on the unique playlist ID's i get from the spotify api I'm working on. Each time I click ...
-1
votes
1
answer
36
views
android.content.res.Resources$NotFoundException: String resource ID #0x2b
I'm making an Java application that is Calculator. My problem is that my app crashes when user enter the second number.
It gives ResourceNotFoundException : String resource ID 0x2b.
I am familiar to ...
-3
votes
0
answers
27
views
How to call an onClick Javascript Function from PHP [duplicate]
<<<HTML
<div onclick="myOnClickMethod($var1, $var2)">Hello World!</div>
HTML;
I am trying to call an onclick js function in PHP.
With my Heredoc attempt above ...
0
votes
1
answer
28
views
Trouble setting state with onClick function only with ImageMapper component (react-img-mapper)
I'm trying to create an interactive image map using the ImageMapper component from react-img-mapper (based on react-image-mapper) in my ReactJS app. I want to be able to click an "area" on ...
0
votes
2
answers
25
views
Uncaught Error: When called with an action of type "DELITEM", the slice reducer for key "addItem" returned undefined
Uncaught Error: When called with an action of type "DELITEM", the slice reducer for key "addItem" returned undefined. To ignore an action, you must explicitly return the previous ...