Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $('input.number').each(function () {
- $(this).keypress(function(e){
- if(e.keyCode == '46' || e.charCode == '46'){
- if(document.selection){
- var range = document.selection.createRange();
- range.text = ',';
- }else if(this.selectionStart || this.selectionStart == '0'){
- var start = this.selectionStart;
- var end = this.selectionEnd;
- $(this).val($(this).val().substring(0, start) + ','
- + $(this).val().substring(end, $(this).val().length));
- this.selectionStart = start + 1;
- this.selectionEnd = start +1;
- }else{
- $(this).val($(this).val() + ',');
- }
- return false;
- }
- });
- });
- <input type="text" class="number"/>
- <input class="number" type="number" lang="es-ar">
Add Comment
Please, Sign In to add comment