How to select all the cells between the beginning of the drag and drag the end in the current row, Drag can only be possible in the current row of the selection, it is necessary to prevent vertical drag
check my fiddle http://jsfiddle.net/kannankds/3xakkja9/3/
$(function () {
var isMouseDown = false;
$("#mytable td")
.mousedown(function () {
isMouseDown = true;
$(this).toggleClass("hilight");
var $this = $(this);
parent = $this.closest('tr').get(0);
return false;
})
.mouseover(function () {
if (isMouseDown) {
$(this).toggleClass("hilight");
}
});
$(document)
.mouseup(function () {
isMouseDown = false;
});
});
source
share