0

Is it possible to collect the elements that have been select with the mouse left down mouse over. Similar to selecting text.

window.getSelect().rangeCount.... will give me an element that has focus, and only limited text.

EG:

<div id="E1"> <input type"checkbox"><a href="some entry 1"> Entry1 </a></div><br/>
<div id="E2"> <input type"checkbox"><a href="some entry 2"> Entry2 </a></div><br/>
etc...

if I highlight / select a number of Entries with the mouse. on a mouse up event, how can I identify what entries, elements or divs are selected.

If I hold down the left mouse button and move the mouse over a number of the entry elements, say "Entry3" to "Entry9" are highlighted. Now that these (or atleast the displayed text) are highlighed, as the mouse is release, I can get a OnMouse Release event. In this Event, can I tell what elements, div Ids or anchors or anything that will allow me to know that "Entry3,4,5,6,8,9" were highlighted.

BitSmith
  • 116
  • 6
  • When you say "highlight/select", what do you mean by that? Selecting a checkbox or selecting text? – Derek 朕會功夫 Sep 08 '17 at 08:28
  • It's hard to understand what you mean. If you want to get the current selection then window.getSelect() is right... But it seems it is not what you are looking for, please add more information, or maybe a usage example? – Salketer Sep 08 '17 at 08:31
  • Just like you would select text in the page. Hold down mouse button and move mouse over text that you want selected, it will be highlighted as normal. And when the mouse left button is released, a mouse up event could be fired. When I get in the event code, can I collect any identifiing in format about what has be selected or highlighted. – BitSmith Sep 08 '17 at 08:31
  • 2
    Possible duplicate of [Get selected text and selected nodes on a page?](https://stackoverflow.com/questions/361130/get-selected-text-and-selected-nodes-on-a-page) – xxxmatko Sep 08 '17 at 08:32
  • @xxxmatko. Thanks I was rephrasing the question for an hour or so and didn't find this reference. Cheers. First look is promising. – BitSmith Sep 08 '17 at 08:43

0 Answers0