How do I cancel a text selection after the initial mousedown event?
- by cwillu-gmail
I'm trying to implement a pop-up menu based on a click-and-hold, positioned so that a (really) slow click will still trigger the default action, and with the delay set so that a text-selection gesture won't usually trigger the menu.
What I can't seem to do is cancel the text-selection in a way that doesn't prevent text-selection in the first place: returning false from the event handler (or calling $(this).preventDefault()) prevents the user from selecting at all, and the obvious $().trigger('mouseup') doesn't doesn't do anything with the selection at all.
This is in the general context of a page, not particular to a textarea or other text field.
e.stopPropogation() doesn't cancel text-selection.
I'm not looking to prevent text selections, but rather to veto them after some short period of time, if certain conditions are met.