regex kyeup and replace
Hello,
I want to restrict users can not enter characters other than numbers and single dot.
Just like price: 12.45, 100.56, 456.00
<script type="text/javascript">
jQuery(function($) {
$('.price').keyup(function () {
if (this.value != this.value.replace(/[^0-9\.]/g, '')) {
this.value = this.value.replace(/[^0-9\.]/g, '');
}
});
});
</script>
<input type="text" class="price" value="" />
But in my case allow enter many dots, many digits after the point.
I have…
regex kyeup and replace
See original post by bumbar
Leave a Reply
You must be logged in to post a comment.