This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Aug 29th, 2013  |  syntax: None  |  size: 1.01 KB  |  views: 26  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. function onlyNumbers(){
  2. if($('#GoalQuestionValue').val().toString().length>10) return false;
  3. if($('#GoalQuestionValue').val().indexOf('.') != -1 && $('#GoalQuestionValue').val().toString().length-$('#GoalQuestionValue').val().indexOf('.') >2) return false;    
  4. }
  5.        
  6. function onlyNumbers(){
  7. var n = $('#GoalQuestionValue').val().toString().split('.');
  8. if(n[0].length > 8 || n[0].length < 2) return false; else return true;
  9. }
  10.        
  11. $("#GoalQuestionValue").keypress(function (e) {
  12.     if (e.keyCode >= 48 && e.keyCode <= 57) {
  13.         if (!isValidNumberStr(this.value)) return false;
  14.     }
  15. })
  16.        
  17. function onlyNumbers() {
  18.     var myArray = $('#GoalQuestionValue').val().toString().match(/([0-9]*).?([0-9]*)?/);
  19.     if(myArray[1]) {
  20.         if(myArray[1].length > 10)
  21.             return false;
  22.         if(myArray[2]) {
  23.             if( myArray[2].length > 2 )
  24.                 return false;
  25.             if( myArray[1].length + myArray[2].length > 10)
  26.                 return false;
  27.         }
  28.         return true;
  29.     }
  30.     return false;
  31. }
clone this paste RAW Paste Data