Seems like a weird problem but probably a simple answer.
Check out this CodePen.
You'll see that I've set it up where on mousedown
, it checks for selected text. If true and not empty, it sets text_selected
to 1 (or true) and returns the selected text.
On mouseup
, if text_selected
is true, it should print 1 and the selected text... but it doesn't!
If you click it a 2nd time it will, but that's no good. Why isn't it updating prior to mouseup
?