Skip to content

Instantly share code, notes, and snippets.

View thebaer's full-sized avatar
🎯
Focusing

Matt Baer thebaer

🎯
Focusing
View GitHub Profile
@thebaer
thebaer / num.inp.detect.js
Created June 22, 2012 14:57
Detects which method was used to change the value in an HTML5 number input (clicking to increment or entering a number)
var key = false;
var inp = false;
var click = false;
// Get the input method
$('#inp').bind('input keypress mousedown paste', function(e) {
$('#inp').after('<br>' + e.type);
if (e.type == 'input') {
inp = true;
} else if (e.type == 'keypress' || e.type == 'paste') {
key = true;