<input type="text" class="dot"> <br />
<input type="text" class="dot"> <br />
<input type="text" class="dot"> <br />
$('.dot').keydown(function(){
$(this).val($(this).val().toString().replace(/\./g, ','));
})
In this example i replace dot to comma. How can i block the addition of two commas in current input?
If in input is already one comma then next should be remove.
This is a classic case of trying to solving a problem with regular expressions, and now you have two problems…
It’s not clear exactly what you want, but this will stop multiple presses of the comma key. It should be a short step from here to detect the period (code 190) and do whatever you want with it instead.