December 8, 2015

Check for Float value on keypress using JQuery

Following is script by which you can put check for float value.

html input field on which you want to put check for float value:
 <input class="checkfloat" type="text">  

Script for Float Value check:
 $(".checkfloat").on("keypress keyup",function (event) {  
     if ((event.which != 46 || event.which == 8 || event.which == 9 || $(this).val().indexOf('.') != -1)   
               && ((event.which < 48 || event.which > 57))) {  


We shall not be liable for the improper or incomplete transmission of the information contained in this communication nor for any delay in its response or damage to your system. We do not guarantee that the integrity or security of this communication has been maintained or that this communication is free of viruses, interceptions or interferences. Anyone communicating with us by email accepts the risks involved and their consequences. We accept no liability for any damage caused by any virus transmitted by this site.