how to make cell selection row by row not zigzag way

see fiddle

I want to drag the mouse on cell and whatever is under cells gets selected. only its under cell get selected. if user moves mouse zigzag way then no selection be happen. How can i do that. .

above image show correct way of flow


Here is a possible solution from the posted jsfiddle.

Instead of highlighting based on each item that has been moused over, we can look at the index of the first (being the one clicked) and the last (being the one currently hovered with an active click drag state) and highlight all cells between.

Check this topic. i think this will help you to know on which element an item is currently being dragged on

Need Your Help

Regex: Select first character then rest between tags

html regex

Im looking to scrape some html and output with colors

Spring tiles - Open in new window

java jquery spring jsp tiles

In my app I'm using Spring MVC + tiles + jsp + jquery.