3
I would like to know how to catch the event with Jquery text selection + drag.
An example of what I am saying, is to select a text and with the left mouse button pressed, move the text sideways.
How do I get this event. Let’s say: if a certain text is selected in the div and I click on it and move. How would you find out that this event occurred? For it’s not just selecting, it’s clicking and moving the selection.
Analyzing, I found this example, where I am prevented from selecting the text of div with drag. I know it’s possible to do with css, but in my situation there are inputs, so maybe someone wants to select.
https://jqueryui.com/draggable/
How did they prevent the selection of text in the above example?
Daniel, that’s almost what I want to do. But it’s not moving what was selected and placed in another div. It’s moving what is selected. Let’s say, I select the text, it gets the "blue" background. So if I click it and move, I can put it in "inputs". What I would like to do is detect the click and the event moves in the selected text. Is there anything to detect that an event occurred in a selected text? or will I have to add some tag before and after the selected text and remove it when the selection does not exist? ATT
– abcd
You can do this, but visually it won’t look good. A visually friendlier solution is to make an element appear on top of the place where you selected the text with the selected text snippet and the user uses this element to drag. Basically it is to take this example that I passed you above but positioning/showing the element with the selected text on top of the selected text.
– Daniel Beff