P
P
Platon Fedorovich2015-10-07 14:19:33
JavaScript
Platon Fedorovich, 2015-10-07 14:19:33

How to instantly change/delete a character in an input when entering data (using jQuery)?

Good day!

There is a simple jQuery solution (plugins - no suggestion!) to replace (or remove) a character from input as you type. That is, I need: when the user enters text (or inserts it with the mouse) into the input - if a comma was entered (inserted), then instantly delete it.

Here's my implementation attempts: jsfiddle.net/GwxeA/85

This is where deletion works if the user is typing. But, if I copy the text containing the comma and paste it with the mouse through the context menu and do not enter anything else in this field, then my code will no longer work. Yes, after sending this input to the server, you can go through the regular expression and replace all commas, but I would like a solution before sending ...

Tell me how to solve it, please.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Maxim E, 2015-10-07
@platon_fedorovich

input events

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question