{"_id":"jquery-number","_rev":"2-7d6219c915629d8eb56b76420b258258","name":"jquery-number","description":"This is a jQuery plugin which allows developers to easily format numbers for display use. Allows users to replace numbers inline in a document, or return a formatted number for other uses.","dist-tags":{"latest":"2.1.6"},"versions":{"2.1.6":{"name":"jquery-number","main":"jquery.number.min.js","description":"This is a jQuery plugin which allows developers to easily format numbers for display use. Allows users to replace numbers inline in a document, or return a formatted number for other uses.","license":"MIT","version":"2.1.6","contributors":[{"name":"customd"}],"gitHead":"8dae33d96ca84c7fe3fe7aed41501487754549d8","_id":"jquery-number@2.1.6","scripts":{},"_shasum":"358a3f954b059ff8f3ee9e8b168d99d1244f811a","_from":".","_npmVersion":"4.6.1","_nodeVersion":"7.10.0","_npmUser":{"name":"andersevenrud","email":"andersevenrud@gmail.com"},"dist":{"shasum":"358a3f954b059ff8f3ee9e8b168d99d1244f811a","tarball":"https://registry.npmjs.org/jquery-number/-/jquery-number-2.1.6.tgz","integrity":"sha512-vf0zXpiri5zHa5wGZy16LmdMUSl1BCAD0Bt49IU2f+3S2fPvYzs70T8dGHSBJnNXrHZcGMPVpf1X3R430cFmnA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEvcZJBdErOUQM7GtNoxhXtRHGA63Vv/V36NxTFDFzD2AiAkytwBYH12x1YA0WfwB10Qhdbt/wgAUPfgts0KMSU9Ow=="}]},"maintainers":[{"name":"andersevenrud","email":"andersevenrud@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/jquery-number-2.1.6.tgz_1496672504085_0.2798357498832047"}}},"readme":"# jQuery Number Plugin\n\n### By Sam Sehnert, [Custom D](https://www.customd.com/) 2015\n\nThis is a [jQuery](http://jquery.com/) plugin which allows developers to easily format numbers \nfor display use. Allows users to replace numbers inline in a document, or return a formatted number\nfor other uses.\n\nRequires jQuery 1.6 or greater.\n\n## Documentation\n\nSee our [jQuery Number Format article](https://www.customd.com/articles/14/jquery-number-format-redux) for more information.\n\n### Basic number formatting\n\nThe number method takes up to four parameters, but only the first one is required.\n\n1. Number: The number you want to format.\n\n    ```javascript\n    $.number( 5020.2364 ); // Outputs 5,020\n    ```\n2. Decimal Places: The number of decimal places you wish to see. Defaults to 0.\n\n\t```javascript\t\t\n    $.number( 5020.2364, 2 ); // Outputs: 5,020.24\n    ```\t\t\n3. Decimal Separator: The character(s) to use as a decimal separator. Defaults to '.'.\n\n    ```javascript\t\t\n    $.number( 135.8729, 3, ',' ); // Outputs: 135,873\n    ```\n4. Thousands Separator: The character(s) to use as a thousands separator. Defaults to ','.\n\n    ```javascript\n    $.number( 5020.2364, 1, ',', ' ' ); // Outputs: 5 020,2\t\n    ```\n\n### Number formatting as-you-type\n\nWhen targeting a collection of input elements, you can have the number format plugin automatically format the users\ninput based on your format settings.\n```javascript\n$('input.number').number( true, 2 );\n```\n\nPassing `true` to the number parameter, indicates that you want the value of the field or element to be effected, instead\nof placing the passed number into the field or element. All other parameters are as decribed above.\n\nWhen the user types, their input will automatically be converted in the correct format. This also attaches [.val() hooks](http://blog.jquery.com/2011/05/03/jquery-16-released/)\nwhich allow you to continue using `.val()` to set your input elements, and you don't need to worry about handling the formatting.\n\nAutomatic paste formatting is also supported. \n\n\n### Writing numbers into an element\n```javascript\n$('.selector').number( 1234, 2 ); // Changes the text value of the element matching selector to the formatted number.\n```\n\n### Formatting numbers within a collection of elements\n\nAssuming we have the following structure:\n```html\n<p>\n  <span class=\"number\">1025.8702</span>\n  <span class=\"number\">18023</span>\n  <span class=\"number\">982.3</span>\n  <span class=\"number\">.346323</span>\n</p>\n```\n\nWe can use this JavaScript:\n```javascript\n// the 'true' signals we should read and replace the text contents of the target element.\n$('span.number').number( true, 2 )\n```\nAnd come away with this result:\n```html\n<p>\n  <span class=\"number\">1,025.87</span>\n  <span class=\"number\">18,023.00</span>\n  <span class=\"number\">982.30</span>\n  <span class=\"number\">0.35</span>\n</p>\n```\n","maintainers":[{"name":"andersevenrud","email":"andersevenrud@gmail.com"}],"time":{"modified":"2022-06-19T05:08:16.511Z","created":"2017-06-05T14:21:45.055Z","2.1.6":"2017-06-05T14:21:45.055Z"},"contributors":[{"name":"customd"}],"license":"MIT","readmeFilename":"README.markdown"}