+ 4

is there a way to detect mouse click end event in javascript.

I know there's mouseup event, but is there another way to trigger action after click event ends?

15th Oct 2020, 1:43 PM
fmntd
fmntd - avatar
15 Answers
+ 1
Your welcome!
15th Oct 2020, 4:43 PM
JaScript
JaScript - avatar
+ 4
🇮🇳Vivek🇮🇳 What if user does not end mouse click in 1second(1000ms)? You can't use setTimeout.
15th Oct 2020, 2:14 PM
Raj Chhatrala
Raj Chhatrala - avatar
+ 2
Yeah but that's delayed by 1 second. mouseup event is the best option.
15th Oct 2020, 2:45 PM
Raj Chhatrala
Raj Chhatrala - avatar
+ 2
that's good enough, I'm trying to figure out how mouseevent works
15th Oct 2020, 4:26 PM
fmntd
fmntd - avatar
+ 1
that events order is ready helpful
15th Oct 2020, 4:27 PM
fmntd
fmntd - avatar
+ 1
let timer; button.addEventListener("click", ()=> { setTimeout (()=> console.log("clicked") , 1000) })
16th Oct 2020, 2:38 PM
Ahmad Khosravani
Ahmad Khosravani - avatar
+ 1
You can also use jQuery. There is a function for exactly your problem: mouseup()
17th Oct 2020, 12:55 PM
JulHirsch
JulHirsch - avatar
0
You can use setTimeout. let timer; button.addEventListener("click", ()=> { setTimeout (()=> console.log("you clicked me") , 1000) } )
15th Oct 2020, 1:53 PM
🇮🇳Vivek🇮🇳
🇮🇳Vivek🇮🇳 - avatar
0
RDC I can use setTimeout. My code is working perfectly fine. https://code.sololearn.com/WFiYu89241hB/?ref=app
15th Oct 2020, 2:43 PM
🇮🇳Vivek🇮🇳
🇮🇳Vivek🇮🇳 - avatar
0
May be. But you can control setTimeout delay
15th Oct 2020, 2:48 PM
🇮🇳Vivek🇮🇳
🇮🇳Vivek🇮🇳 - avatar
0
The order of events related to the onmouseup event (for the left/middle mouse button): onmousedown onmouseup onclick
15th Oct 2020, 4:03 PM
JaScript
JaScript - avatar
0
fmntd If this would not be sufficient, then the asynchronous function must be used.
15th Oct 2020, 4:21 PM
JaScript
JaScript - avatar
0
Hello I want to display a product during the morning period, and at the end of the morning, another product is displayed during the evening period and so on
18th Oct 2020, 2:10 PM
ابو العز
ابو العز - avatar
0
JulHirsch, that's not what I want.
18th Oct 2020, 2:37 PM
fmntd
fmntd - avatar
- 3
click
15th Oct 2020, 1:51 PM
JaScript
JaScript - avatar