Git Product home page Git Product logo

jquery-numeric_input's People

Contributors

manuelvanrijn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

jquery-numeric_input's Issues

incorrect value for autocomplete

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

initial fix input

when initializing the plugin on a input, I want it to check/parse the value so it matches the decimal option

Apple safari

This disable cmd+c copy text from input
jQuery("#test").numeric_input({
decimal : "."
,allowNegative: true
});

Integer input

Is there a way for input to accept only integers?

Adding decimal separator at caret

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").

Does not work in IE8

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!

Special key's

Some key presses doesn't work, like backspace, tab, delete etc.

add comma for decimals :

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);
});

add "Ctrl+A" in specific keys

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;
        }

Error on Travis CI

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.

Select all text when it focus

$.fn.numeric_input.defaults = {
selectOnFocus:true
}

//--------------//
if (_instance.options.selectOnFocus === true) {
_instance.$elem.on('focus', function (e) {
_instance.$elem.select();
});
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.