Closed nelsonic closed 6 years ago
Sample code for Double Click Event Handler:
<div onclick="doubleclick(this, function(){alert('single')}, function(){alert('double')})">click me</div>
<script>
function doubleclick(el, onsingle, ondouble) {
if (el.getAttribute("data-dblclick") == null) {
el.setAttribute("data-dblclick", 1);
setTimeout(function () {
if (el.getAttribute("data-dblclick") == 1) {
onsingle();
}
el.removeAttribute("data-dblclick");
}, 300);
} else {
el.removeAttribute("data-dblclick");
ondouble();
}
}
</script>
as a user I want to edit a todo list item so that I can change a mistake or update the copy
<label>
to edit https://en.wikipedia.org/wiki/Double-click https://stackoverflow.com/questions/5497073/how-to-differentiate-single-click-event-and-double-click-eventsignal('EDIT', item.id)
ENTER
key submits the editESC
(escape) key cancels the edit. #64