samwm / jquery-plugins Goto Github PK
View Code? Open in Web Editor NEWPlugins I have developed for jQuery
Plugins I have developed for jQuery
Hi,
If you put for example 15.30 to the input which should have only 2 decimal places you cant put any more digits to it anymore. But if you put cursor in the middle and erase 5 so you have 1.30 you then cant add 5 after 1 as will which should be possible. Also selecting whole number in input (cmd+a) and start typing doesn't erase whats already in the input as well.
Can I set the min value and max value? (i.e. 0.00 < x < 0.99)
or the length of the number? like the maximum can only 5 significant digit
I would like the addition of a callback for ALL keypresses, not just invalid characters. This would be helpful in implementing formatting, like currency values.
Is it possible to use the plugin with jQuery live
I have fields that are added to the form after the page load, I would like these to be numeric only, guessing I'll need to manually wire those up?
Is it possible to forbid the . and have only integer values?
I can't place any dot here. but I can hold dot so it type many dots.
Hi
I've used this plugin on a site where I've prototyped Array object:
"Array.prototype.maxNum = function () {...}"
I've noticed that this property has been included in my select box when this plugin fired.
To avoid this problem, this (line no. 111 in jquery.selectboxes.js):
------------------- CODE ---------------------
for(var item in items)
{
add(this, item, items[item], sO, startindex);
startindex += 1;
}
should have additional check if it is own property:
------------------- CODE ---------------------
for(var item in items)
{
if (items.hasOwnProperty(item)) {
add(this, item, items[item], sO, startindex);
startindex += 1;
}
}
Regards,
Marcin Gosz
[email protected]
Instead of just recording if the decimal key was pressed, I made a change that fixed what was a pretty annoying bug.
Reproduce this bug:
So to fix it, I changed the condition around line 100 that checks for a flag being true to instead actually inspect the string for the presence of the decimal in the first place. Here's the relevant code:
if($(this).val().indexOf(".") == -1)
I hope this gets migrated into the stock plugin code.
Thanks!
Using the demo http://code.webmonkey.uk.com/plugins/jquery.numeric/test.html (numeric version 3.1) in Internet Explorer (tested on 9,11) there is an UX issue.
I fixed this issue myself by downloading another version of the numeric plugin (version unknown + not specified) from http://www.texotela.co.uk/code/jquery/numeric/ and modified two lines of code. At Line 58 + 95 changed decimal.charCodeAt(0) to decimal.toString().charCodeAt(0).
Would appreciate if somebody could look at this issue please.
I'm using selectboxes with jQuery 1.3.2 and everything working fine. But when updated jQuery to 1.4.2 or 1.4.4 ajaxAddOption() not working anymore.
EDIT:
Found what's wrong. Due to jQuery 1.4.x strict implementation of JSON I've forgot to put JSON data into brakets. After fix that all working fine :)
hi, i hope i'm not missing anything, but i don't think there should be anything i'm missing. the problem i'm having is a mere comment/uncomment problem. if i uncomment the sortOptions lines below the script works fine. Once i uncomment them, the script halts.
any idea why?
thanks!
$('#uploadPic_select').addOption(albName, albName);
$('#manageAlbum_select').addOption(albName, albName, false);
// $('#uploadPic_select').sortOptions(true);
//$('#manageAlbum_select').sortOptions(true);
$('#uploadPic_select').removeOption('createAlbum_select').addOption('createAlbum_select', ls_ca_optn, false);
clearLoadingMessage(); // hides a modal, nothing to do with the select
$('#createAlbumModal_div').jqmHide(); // hides a modal, nothing to do with the select
outputSuccess(ls_acs_txt); // open a modal, nothing to do with select
return false;
When an object has numeric enabled, its change event is not triggered. Please check this fiddle:
http://jsfiddle.net/aprudencio/6hBEt/
PD: I couldn't find a CDN for numeric so I created a public numeric.js file using dropbox with numeric.js latest version: 8d1b328
CDN file: https://dl.dropboxusercontent.com/u/58926565/cdn/numeric.js
Hi,
We noticed a strange exception on line 42 of selectboxes.js :
el.cache[o[i].value] = i;
For unknonw reason, on regular web browser, if el.options is empty , it would be
[]
but on IOS 8, it would be
[null]
So I simple wrapped it with a try catch to avoid this strange issue with IOS8. I don't really know if this is a real fix, but just my quick workaround :
try {
el.cache[o[i].value] = i;
} catch (e) {
}
Currently, selection/highlighting of text by keyboard, including Ctrl+A, doesn't work. This is because at the end of the keyup callback function, the selection is reset to be just where the carat (start and of selection are the same).
This could be fixed by modifying the keyup callback to save not the selection start, but also the selection end.
When I try to use $(selector).numeric(",") allows me to use dots instead of comma.
Accordion and Newsticker doesn't work together. what can I do, am i helpless?
I have an input control which I use like this
$("#money").numeric(".");
$(#money").change(function() {
alert ("Never called");
});
Any idea what is going on here ?
How am i able to set the limit decimal point during the enter value in input
I must missing something obvious. I tried this:
$("#id_letter_types").addOption(data.letter_types, false);
but I'm getting "Uncaught Type Error: Object [object Object] has no method addOption"
(chrome's developer tools tell me that #id_letter_types points to the right stuff, and data.letter_types is fine too)
so I'm guessing that there must be something I have to do in document.ready() to get the addOption function tied to my select widget.
any hints?
is there a way to edit an existing entry?
if not, please consider a feature request.
Option to disallow usage of a separator. Could be something like this:
$('input').numeric({separator:false})
which would produce a input field with possibility to input integers only without thousand separator, decimal separator and so on.
Hi,
Thanks for your work!
I was wondering if you could tag a release? That would be very helpful!
Thanks in advance :)
When entering an input field that already has a value the cursor is placed in front of the string which is anoying when jumping from one input to the next using the tab key.
It would be great to be able to use optgroups with ajaxAddOption. Is that currently possible?
/Oscar
When we trying to enter dot it works for the first time but after that we are not able to enter dot again. Saw this bug on the project examples page (http://www.texotela.co.uk/code/jquery/numeric/), using firefox 3.5.9
If anyone is having binding issues with elements inside a foreach binding in knockout js that also have numeric applied, please read this: https://groups.google.com/forum/?fromgroups=#!topic/knockoutjs/G7BQK_so7SU
In IE when using the cursor keys to move through the numbers to edit cursor jumps and selects numbers
Hi,
There is a problem with .numeric
When you type the character "#", it is accepted in Chrome.
Google crome 9 sort json by key and as a result we get unordered list in the dropdown.
I fixed this problem by adding sortOptions(true) and it works for me
$("#dd_menu_id").addOption(response, false).sortOptions(true);
please add the bower file to this project.
I have SamWM's jquery.numeric REPO up on bower:
http://bower.io/search/?q=jquery_numeric_samw
It would be nice if this was supported and maintained by the author(s) because there are a ton of other copies of jquery.numeric on bower, and they are all the old version. Only have one jquery.numeric up on bower, and it is the authors version.
If someone was to try and use this library with version control, they would have to do some sluething to find the right one.
Hi dear,
Now I using bellow script for format numbers.
it is small and better than ... tested.
with special thanks to my dear friend Mr.Ali Mostafavi.
.numeric cssClass for just numbers.
.numericAmount cssClass for numbers with thousands separator.
.numericAmountDecimal cssClass for numbers with decimal and thousands separator.
In Firefox if the value in the text box already have a decimal point, then delete key is not working. But back space key will work.
But delete will work in IE and Chrome.
I have a work around for this:
Here is the code snippet I put:
if(key == decimal.charCodeAt(0)) {
if(!this.containsDecimal) {
allow = true;
this.containsDecimal = true;
} else {
if(key == 46) {
if(e.charCode == 0) return true;
if(this.containsDecimal) return false;
return true;
}
allow = false;
}
}
Hi,
On IE 11 this plugin crashes when entering any value on a numeric textbox because document.selection.createRange() is not supported from IE 11
http://msdn.microsoft.com/en-us/library/ie/ms535869%28v=vs.85%29.aspx
Unable to get property 'createRange' of undefined or null reference
line 255 on jquery.numeric.js
Please can you look into this and fix this issue.
In Firefox if you remove a decimal point from the input box once, then you can't put a decimal point back.
Workaround for this:
if(!$(this).val() || $(this).val().indexOf('.') == -1) {
this.containsDecimal = false;
}
Put above code snippet above the line : var allow = false;
Hi all,
I was trying to use this plugin and have issues with sorting of the option in the dropdown.
i.e. if i have 6,5,4,3,2,1 as the option which are added into the dropdown using addoption in the same order, in the browser I am getting values 6,2,5,3,4,1.
can any one help with this please ASAP.
note : it is happening in all the browsers
thanks & regards
BK
As mentioned in the title, jQuery Numeric allows non-numeric input (i.e. letters) into inputs in IE8 when using jQuery 1.7>. I can put together a jsFiddle if desired.
(this concerns the numeric text field for me, might be applicable to more)
Explicitely checking for and allowing things like ^V, ^Z, etc. breaks common browser functionality like opening a new tab with ^T. Any hotkeys defined by users will also be denied for no good reason.
It does not working cause of e.charCode in Opera is undefined.
I have fixed it in jquery.numeric.js file, method $.fn.numeric.keypress in line 84:
else if(key == 8) {
//For Opera..
allow = true;
}
Hello,
I am unable to get the copyOptions function within Select Box Manipulation to fire off in Safari 5. I am not getting any error, it just doesn't function. Works fine in Firefox 3.6.11
Cheers,
Matt
Hola bueno eso que el plugin no funciona bien en google crome, no detecta los puntos es decir puedes registrar n puntos en el campo.
haber si le das una chequeadita de todas formas si puedo lo hago y te lo envio jeje
if (key == 39) {
return false;
}
The backspace works but not the DEL key.
Hey guys,
I'm the maintainer of https://github.com/plentz/jquery-maskmoney. I just looked at your source code and options and you do basically the same as we do. What do you guys think about merging the two projects and joining forces?
I'm asking it because I saw as well that you have quite a bit of issues and pull requests open(a few of them we already solved - like #18 #59) and I know the work that is required to maintain an open source project, so more hands and eyes looking at the same code is pretty good.
Well, let me know what do you guys think :)
cc @SamWM @qeny @robballou @aleffnull @mikelikesbikes @aaccioly @ajgon @bruno-cadorette @wayne-zhang @Zolfaghari @chris-allen @eliezer @jalchr @mdreak
Hi, I have try the example on http://www.texotela.co.uk/code/jquery/numeric/
but when I try to type in alphabet it not show the alert message.
Have you solved this?
0a1,2
(function($) {
28c30
< jQuery.fn.numeric = function(decimal, callback, allowDecimal, allowNegative)
$.fn.numeric = function(decimal, callback, allowDecimal, allowNegative)
136c138,140
< }\ No newline at end of file
}
})(jQuery);
\ No newline at end of file
I can paste non-numeric values in a numeric() field.
$.fn.removeNumeric = function()
{
return this.data("numeric.decimal", null).data("numeric.negative", null).data("numeric.callback", null)
.unbind("keypress", $.fn.numeric.keypress)
.unbind("keyup", $.fn.numeric.keyup)
.unbind("blur", $.fn.numeric.blur);
};
I am dynamically binding the html to a table which adds a textbox on click of a button.
How do I bind the numeric validation to each textbox and prevent multiple binding and bubbling of events?
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.