views:

28

answers:

1

Is there a jQuery plug-in to remap the "dot" key in the numeric keypad? The purpose is to make it print a decimal separator, rather than a dot, in languages that use commas or other characters. I'd like to mimic the behaviour of some desktop applications like MS Excel.

(It's okay to hard-code the output character.)

A: 

You do not need a plugin, you can bind to every input element a function that replace dot with comma or other character on keyup event.

$(":input")​.bind({
    "keyup" : function (e) {
        if (e.keyCode==110) {
            e.currentTarget.value = e.currentTarget.value.replace(/\./g,",")
        }
    }
    })​
ungarida
Probably it is even more correct to replace only last dot char.
ungarida
I'm willing to write my own code, but only if there isn't a plug-in already because it's not as easy at it appears. Your sample code, for instance, prevents normal text edition: it moves the caret to the end of the text.
Álvaro G. Vicario
It appears that there isn't such plug-in so I'm accepting your answer as the closest one. I've started working in my own plug-in.
Álvaro G. Vicario