jquery allow only numbers and decimal

jquery allow only numbers and decimal : here you can learn to How to allow numeric (0-9) & decimal value textbox using jQuery?.

jquery allow only numbers and decimal

jQuery Allow Numbers and Decimal only in Textbox [numeric]. Steps to allow only numbers and dot (decimal/ float).

$(function () {
        $("input[id*='txtQty']").keydown(function (e) {


            if (e.shiftKey == true) {
                e.preventDefault();
            }

            if ((e.keyCode >= 48 && e.keyCode <= 57) || (e.keyCode >= 96 && e.keyCode <= 105) || e.keyCode == 8 || e.keyCode == 9 || e.keyCode == 37 || e.keyCode == 39 || e.keyCode == 46 || e.keyCode == 190) {

            } else {
                e.preventDefault();
            }
            
            if($(this).val().indexOf('.') !== -1 && e.keyCode == 190)
                e.preventDefault();

        });
    });

Jquery - Allow Only Numbers and 2 Decimal in Textbox Example

index.html




    Jquery Only Allow Input Float Number - www.pakainfo.com
    


  

Jquery Only Allow Input Float Number - www.pakainfo.com

Example 2: Jquery Only Allow Input Float Number

index.html




    Jquery Only Allow Input Float Number - www.pakainfo.com
    


  

Jquery Only Allow Input Float Number - www.pakainfo.com

Don't Miss : JQuery Allow Only Numbers Input In Textbox

I hope you get an idea about jquery allow only numbers and decimal.
I would like to have feedback on my infinityknow.com.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

Leave a Comment