jQuery-Knob icon indicating copy to clipboard operation
jQuery-Knob copied to clipboard

Cant manually type a number when min amount is set

Open rob-ot-dot-be opened this issue 11 years ago • 3 comments

I have a knob where the min amount is set to 500. Stopper is set true.

When I want to type in a new amount, then the input field will automatic jumps to the min amount. Thus when i want to set 124 as amount, it will jump to 500 the moment I type 1.

rob-ot-dot-be avatar Mar 26 '14 13:03 rob-ot-dot-be

Same issue here. From the code it seems to have something to do with the knob validating the values when you do a keyup/keydown. So when you key in the first digit immediately it detects the value to be less than the min and sets it accordingly. I tried changing the jquery.knob code a little but its not a perfect solution. Anyone has a workaround (preferably without changing the base code) ?

Gkenn avatar Apr 02 '15 15:04 Gkenn

var knob = $element.knob(...);

knob.children('input').unbind('keyup');

This will unhook the default handler that's mucking up the type-in values. Then, in your custom parse handler, you can check for values outside of your min\max range and handle them accordingly.

pags avatar Jun 22 '19 15:06 pags

var knob = $element.knob(...);

knob.children('input').unbind('keyup');

This will unhook the default handler that's mucking up the type-in values. Then, in your custom parse handler, you can check for values outside of your min\max range and handle them accordingly.

Tried that, but I had an issue with "long time keydown speed-up": in keydown a timeout is set, in keyup in cancelled, thus avoiding the speed up. I decided to change the jquery knob js by deleting post control in keyup (it's done anyway when focus is released).

Simone-Cu avatar Sep 29 '21 22:09 Simone-Cu