JavaScript: easily do a continuous action on mouse hold
I simpliefied the code as much as possible
var intervalHandler;
$('#'+obj_id).mousedown(function() {
intervalHandler = setInterval(function() { doTheWork(); }, 100);
return false;
})
$('#'+obj_id).mouseup(function() {
clearInterval(intervalHandler);
});
function doWork() {
//I am working here
}