jquery - Keyup Validation - Left/Right Arrows Not Working in IE -


i'm using jquery limit characters can entered (specifically on keyup) in textbox (allow numbers, decimal points , left/right arrows, no other characters).

html:

<input class="decimal" id="id" type="text" name="name" value="" aria-invalid="true"> 

jquery:

$('.decimal').keyup(function(){     var val = $(this).val();      if(event.which>=37 && event.which<=40)                 {                     return false;                  }      if(isnan(val)){          val = val.replace(/[^0-9\.]/g,'');          if(val.split('.').length>2)               val =val.replace(/\.+$/,"");     }     $(this).val(val);  }); 

this solution working me, running issue left/arrows not work in ie (but work in chrome, ff, safari, etc.). doing wrong?


Comments

Popular posts from this blog

android - How to save instance state of selected radiobutton on menu -

python 3 IndexError: list index out of range -

IF statement in MySQL trigger -