Questions tagged [event-listener]
An abstract object that is triggered when a particular event occurs in the application or system.
2,527
questions
2
votes
2
answers
72
views
How to make the onClick event only fire when the element is deliberately clicked and not when the click "started" from another element
In the snippet below, if you:
Click down in the red <div> and hold the click down
Then move the cursor to the blue <body> (without releasing yet)
Then release the click when you are in ...
1
vote
1
answer
43
views
Deleting event listeners in dynamic React component
Asking advice on adding and deleting event listeners in dynamic react components.
So, I have a functional component that has a list of objects.
It is being rendered like so:
objectList.map( (item) =&...
-1
votes
1
answer
27
views
Event delegation not working as expected when trying to remove elements in JavaScript
Sure, here's a suggestion on how you could frame your question for Stack Overflow:
Title: Event delegation not working as expected when trying to remove elements in JavaScript
Body:
I'm trying to use ...
1
vote
0
answers
16
views
How to modify a variable in an event listener
i want to modify a variable passed to a constructor and then modify it in an event listener.
for example:
public class LoginDialog extends JDialog{
public LoginDialog(User user) {
....
}
...
0
votes
1
answer
21
views
Scroll child element when in viewport
Can someone help?
I have multiple sticky child elements, some of these has an high height (more than the viewport).
Each child has the following structure:
<section>
<div class="...
1
vote
1
answer
49
views
Update related entity from event-listener callback
General Problem
We have two entities, Parent and Child with a one-to-many relationship between them. When updating the Parent we want to update some entries in all related children automatically.
For ...
-2
votes
1
answer
51
views
Will I hit performance issues if I attach events to each table cell individually? [closed]
It is possible to attach click event to a table and then extract row / column from event. So the DOM will have only one listener. This approach is not convenient as we need to parse event object and ...
0
votes
0
answers
50
views
Why is my event listner so slow and glitchy?
im pretty new to full stack development and im making a hover drop down. im not sure why but when there is nothing but the dropdown portion it works very fast but when i add the rest of the page its ...
0
votes
2
answers
23
views
how can i change the image inside the image tag ( with a class of innerMainImg) how do i pass on to the next image when i click on the current image?
i am creating a webpage page in which i have a div containig an image the img tag has a class of innerMainImg. i have four images in an "images" folder within my project. the images are &...
1
vote
2
answers
62
views
How to get a value from the InnerHTML through a event Listener if you click on or select it
I am Trying to get a value from a Event Listener , I am creating a Game cards it will do comparative among numbers , whatever I select it will take ta value and Run Function it will compare Value ...
0
votes
1
answer
27
views
I need "multiple scopes" inside a event listener method in a class ("this" scope) JavaScript drag and drop API
(Im new to JS)
Im coding a web app that consist in a 4x4 table with numeric pieces from 1 to 15 and an empty space.
I was messing with the drag&drop API, then I noticed that my methods for the ...
0
votes
1
answer
38
views
Clicking element affects that element AND a corresponding linked element
I want to click a div, have that div get a class of active AND its corresponding image to show. The two elements are both in separate containers but in order. E.g. clicking div one causes image one to ...
0
votes
0
answers
12
views
How can I make an element scroll only when it is visible on the page?
I want to achieve a similar effect here:
https://typecode.com/good/
I used intersectionObserver to find when my element 'test' is visible on the page.
Then when it is visible I want that element's ...
0
votes
0
answers
13
views
Javascript: Mouse follow & mouse hover animation with ACF & Elementor Pro
I'm creating a new website in Elementor Pro, based on a design earlier made within Figma.
For some parts I'd need some extra coding I'm struggling with. This coding should work within Elementor Pro ...
0
votes
0
answers
26
views
@PreRemove/@PreUpdate JPA annotations in super and sub classes
after upgrading to JPA 3.1 I encountered a problem.
I have super class A entity what has @PreUpdate and @PreRemove methods annotations coming from jakarta.persistence.
@EntityListeners(...
2
votes
1
answer
51
views
Java ApplicationEvents: Difference between @EventListener annotation and ApplicationListener interface
I am using Java ApplicationEvents to publish and then subscribe listen to an event. What is the difference between @EventListener annotation and ApplicationListener interface. Any differences, or the ...
0
votes
1
answer
43
views
Using @onkeyup in Blazor
So I'm making a simple app in blazor for converting some measurements. I have an input which should trigger a function ConvertUnits(). I want it to be triggered every time I type something in the ...
0
votes
2
answers
40
views
How to log specific text in an ul?
I cannot figure out how to console log the innerText inside of the li and not the p that is nested inside of the li.
HTML
<ul id="list">
<li>Tank
<p>this ...
0
votes
0
answers
36
views
Event Listeners on iframe not working on Chrome with a hosted domain
I am trying to pass message from a new window to an iframe on the same origin embedded on a different domain. I tried message passing using Broadcast Channel API, using localStorage with storage event,...
0
votes
0
answers
39
views
Sveltekit window event listener
I have this code in vanilla js:
window.addEventListener("message", function (event) { /* my code */ })
When I want to add the event listener to my sveltekit app it doesn't work.
I use this ...
2
votes
4
answers
58
views
Calling same function by different objects by pressing different key in python
I have created two turtles say 'tur1' and 'tur2' in python using turtle module. I have created event listener on the screen. I have created a function 'move_fwd(turte_name)' which moves the turtle ...
0
votes
1
answer
58
views
How do I add an onscroll event listener and get the current scroll position of a Scrollview using the ref of the scrollview
I am using react-native-gifted-charts to implement an area chart with mulptiple lines.
Objective: Allow a user to scroll horizontally accross the chart and but always show the minimum full range of ...
0
votes
1
answer
35
views
Having trouble with a Javascript callback function building a piano
I'm about a month in with Javascript and trying to build a piano. My audio is working fine using the keydown event, but now I'm trying to make the specific key of the piano appear as if it was pushed ...
0
votes
0
answers
22
views
Cucumber-JAVA : Getting issue while starting and stopping the driver using ConcurrentEventListener
I am able to successfully initiate the driver when the feature file starts, and the driver stops once all the scenarios within that feature file have executed. However, there are two issues with the ...
2
votes
1
answer
38
views
How to make username creation form stay invisible even on page reload?
So I'm a beginner in javascript, and I am coding a username creation form that displays the created username in a specified container. I already made the form and the EventListener that knows when I ...
0
votes
0
answers
8
views
return from function on event.target.value
Could someone please help me understand why when I write my code for an event listener the code below gives me an error "color1 is not defined"?
let penColor = document.getElementById("...
0
votes
1
answer
59
views
Issue with JavaScript modal and input handling in HTML form
I'm currently working on an HTML form that uses JavaScript to handle modals and input validation. The form is meant to capture a transfer value, and based on the value it should display modals for IA (...
0
votes
0
answers
13
views
Nodejs stream is not getting caught in error event listener. I am using npm Imap module and the stream error is not getting caught in error listener
imap.once('ready', function() {
openInbox(function(err, box) {
if (err) throw err;
var f = imap.seq.fetch('1:3', {
bodies: 'HEADER.FIELDS (FROM TO SUBJECT DATE)',
struct: true
...
1
vote
3
answers
107
views
How to intercept an eventhandler in javascript?
Let's say I have a simple webpage with only a small js file:
document.addEventListener('click', (event) => {
console.log("click event fired");
});
document.addEventListener('keypress'...
1
vote
3
answers
79
views
Kotlin set one listener for multiple controls
I'm approaching to kotlin (and to mobile coding)
I'm trying to set one listener to run the same function on click on everyone of multiple textView.
I found the below code on SO (sorry for missing link:...
0
votes
1
answer
44
views
onload event triggered even the node is removed from dom
<img id="img" src="src/abc.jpg" onload="imgload()"/>
<script>
var img = document.getElementById("img");
img.remove()
function imgload(){
...
0
votes
1
answer
77
views
Laravel, Livewire and Alertify.js - event dispatch - event.detail.xyz returning undefined
My first stack overflow question. Web development hobbyist and learner here. Grateful for any help at all.
I'm using Laravel 10 and livewire 3 with an alertifyjs CDN link. I have an "Add to ...
0
votes
2
answers
76
views
State is not being updated in useCallback
FINAL EDIT: I solved it, check my answer below
EDIT: So, the problem boils down to this. How can i change the value of a state from inside an eventListener? I have tried the things below, as well as ...
0
votes
0
answers
14
views
I need to update the variant weight and id to get the right shipping estimate on a Shopify product page
I have created a shipping estimator for the product page of Shopify, the estimator works for the product/variant ID that the page originally loads with, but not when you select a different variant ...
0
votes
0
answers
24
views
Why doesn't asynchronous processing work on the first run?
Server Info: java 17, spring-boot 3.1.4
Since the parent server (WCS) only wants to know if it received the data it gave it, the logic of converting the data into a form suitable for use by the ...
1
vote
4
answers
84
views
How to use querySelector to remove a specific element from a list?
I set up a webpage with two headings, and two buttons. The webpage looks exactly like the following before pressing on anything:
Counter-1 : (somenumber)
[Increment Button] || [Decrement Nutton]
If I ...
0
votes
0
answers
33
views
Fixing Hibernate Event Listener Order Issue During Migration from Hibernate 3 to 5
Self-answered question
While migrating a Java Tomcat application from Hibernate 3 to Hibernate 5 (specifically version 5.4.24), we encountered an issue affecting our user creation form. The form, ...
-2
votes
1
answer
56
views
How to stop a button from triggering multiple events from previous event listeners
I have a table of transactions and each have a edit button to edit the data and then save it to the database. My issue is if I click to edit one and then multiple others they all save using the same ...
0
votes
1
answer
33
views
React Invalid Hook Call (Nested Hook?)
my goal here is to re-render map generative part again if localStorage data (a json of Layers LayersData) changes. React throws error of
Invalid hook call. Hooks can only be called inside of the body ...
1
vote
1
answer
33
views
Why when I run my code the panel opens but it never reaches the actionPerformed function
panel view of my 2048 gameI am trying to make the 2048 game. I made the terminal version to check my game logic and everything seems to be working. Now I added a GameFrame and GamePanel class. My aim ...
0
votes
0
answers
27
views
why the dispatchEvent does not work in React
I want to create a list of product and user can input the value of quantity in a input element. The elementLitsener which is binded on the input works well, it can change the data which is stored in ...
1
vote
1
answer
58
views
Unable to implement Event Listener in latest Java Cucumber Maven project with JUnit5
Created a new Java Cucumber project with the command -
mvn archetype:generate "-DarchetypeGroupId=io.cucumber" "-DarchetypeArtifactId=cucumber-archetype" "-DarchetypeVersion=...
0
votes
1
answer
59
views
Random characters being deleted from paragraph element after hovering over them
I have two paragraphs that are comprised of 8 rows that each contain 12 characters. The characters are either random symbols or full words whose positions are random. My code is supposed to highlight ...
0
votes
2
answers
47
views
live summing numbers from input fields and displaying it JavaScript
I am trying to figure out how to sum and display input numbers as live calculation.
It kind of works but the calculations are wrong. With each iteration it adds bigger number, like in arithmetic ...
0
votes
0
answers
18
views
Getting Render error when calling function from Alert.alert in react native
When i am calling the function after countdown time finish from the alert its showing error like below i have mentioned
ERROR TypeError: _reactNative.AppState.removeEventListener is not a function (...
1
vote
0
answers
29
views
Why wasn't the PreGet event triggered?(matlab callback-function)
Originally, this example was meant to validate the AbortSet property, but I've encountered another issue. The problem is that the PreGet event isn't triggering when it should.
obj_a=ClassAbortSet;
...
1
vote
0
answers
61
views
Why my event listener isnt being triggered?
I want to send an email after a receipt has been created to the user. I have a Receipt controller which creates a controller which then fires an event Receipt Created Event which should fire a ...
0
votes
2
answers
25
views
Disabling own event listener while it is executing
I have this cool typing effect on my site that executes when you press enter but I do not want users to be able to press enter again while the typing effect is executing.
This is what I am currently ...
0
votes
1
answer
95
views
Spring event publisher is not waiting listener
I have 3 classes on 2 different projects. I want to publish event from one project and wait for the end of the listener method on the other project. But in my case publisher method is not waiting for ...
2
votes
1
answer
103
views
React popover(modal) closes automatically after I click the open button (event listener)
Goal:
I want to implement a popover(modal) in React.
When the user click a button, then the popover is open.
Close the popover when the user clicks outside of the popover.
Logic:
conditionally render ...