manuelvanrijn / jquery-numeric_input Goto Github PK
View Code? Open in Web Editor NEWBlocks all non numeric chars and helps with dot and comma input
Home Page: http://manuelvanrijn.nl/jquery-numeric_input
License: GNU General Public License v2.0
Blocks all non numeric chars and helps with dot and comma input
Home Page: http://manuelvanrijn.nl/jquery-numeric_input
License: GNU General Public License v2.0
When double clicking a input and selecting a value, doesn't trigger the plugin to change the value to match the options.
example:
double click and select 1.0
fills in 1.0
instead of 1,0
when initializing the plugin on a input, I want it to check/parse the value so it matches the decimal
option
when add dynamic input its not working
Hallo Manuel,
De numeric input werkt niet in IE8.
In Chrome, Firefox, Safari en IE9 werkt gewoon goed.
Ik heb de volgende JS code geplaatst:
jQuery(function($) {
$(".product-custom-option").numeric_input({
decimal: '.'
});
})
Weet je misschien wat het probleem is?
Bedankt!
add event to:
if (_instance.preventDefaultForKeyCode(e) === true) {
e.preventDefault();
}
//----------------------//
and add keys to :
switch (keyCode) {
case 0: // browser specific special key
case 8: // backspace
case 9: // tab
case 35: // end
case 36: // home
case 37: // left
case 39: // right
case 144: // num lock
return false;
case 65: // A
if (e.ctrlKey) { return false; }
case 97: // a
if (e.ctrlKey) { return false; }
default:
return true;
}
$.fn.numeric_input.defaults = {
selectOnFocus:true
}
//--------------//
if (_instance.options.selectOnFocus === true) {
_instance.$elem.on('focus', function (e) {
_instance.$elem.select();
});
}
add method :
parseDigits: function (value) {
var nStr = value + '';
nStr = nStr.replace(/,/g, "");
var x = nStr.split('.');
var x1 = x[0];
var x2 = x.length > 1 ? '.' + x[1] : '';
var rgx = /(\d+)(\d{3})/;
while (rgx.test(x1)) {
x1 = x1.replace(rgx, '$1' + ',' + '$2');
}
return (x1 + x2);
}
///-------------------------//
and use it :
_instance.$elem.on('input propertychange', function () {
var parsedValue = _instance.parseValue(_instance.$elem.val());
//custimized comma:
_instance.$elem.val(_instance.parseDigits(parsedValue));
//
_instance.options.callback.call(_instance, parsedValue);
});
Is there a way for input to accept only integers?
Would be nice if could be configured to allow the minus (-) key.
Currently, if you move the caret around the number in the input field (let's say to "2|38"), and press the decimal separator key, the separator will be added to the end of the number (e.g. "238."), not to the caret position as it probably should (e.g. "2.38").
This disable cmd+c copy text from input
jQuery("#test").numeric_input({
decimal : "."
,allowNegative: true
});
Some key presses doesn't work, like backspace, tab, delete etc.
Bug identified in Chrome v50
jquery.numeric_input.js:30
I'm getting the following error:
error: No function configure defined in /home/travis/builds/manuelvanrijn/jquery-numeric_input/node_modules/jquery/node_modules/jsdom/wscript
npm ERR! [email protected] install: `node-waf clean ; node-waf configure build`
npm ERR! `sh "-c" "node-waf clean ; node-waf configure build"` failed with 1
It seems that there's a problem with jsdom
that should be fixed in the near future. Build isn't failing for real.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.