Showing posts with label float. Show all posts
Showing posts with label float. Show all posts

Thursday, 9 October 2014

Enter Floating Number only

Input field onkeyup check floating values only to allow
onkeyup="if (!isFinite(this.value)) this.value = this.value.replace(/(\s+)?.$/,'')"

Tuesday, 19 August 2014

Input field JQuery float validation, decimal validation

$('#price').keyup(function(e){
      var entered_value = $(this).val();
  var regexPattern = /^\d{0,8}(\.\d{1,2})?$/;         
      //Allow only Number as well 0nly 2 digit after dot(.)
      if(regexPattern.test(entered_value)) {
        alert("false") ;  
      } else {
         alert("true");
      }
});