Select some <div> or <span> of the html page

1061 views html5
4

Background: I need to show a mathematical expression and allow user to select (single click or rectangle selection via mouse down/move/mouse up) elements of it. There are some good systems (mathjax, codeblock, ...) to convert a math expression to html, they produce an html composed mainly of a set of div or span blocks. If necessary, custom render could be implemented.

Assume a html5 page that contains several nested or sequenced div and/or span tags. The user must be allowed to choice with their mouse one of these elements or several of them inside a selection rectangle. Any advice about how implement it ?.

The activity could be decomposed in two steps:

  1. the drawing and control of the selection rectangle
  2. given a rectangle, an easy and portable way to know which div or span fails inside the selection

answered question

1 Answer

1

if you know which all elements you want to select you can just extract its XPath check this for more info jquery select element by xpath

posted this

Have an answer?

JD

Please login first before posting an answer.