Posted By

jlvallelonga on 03/24/09


Tagged

get number character code is digit printable


Versions (?)

pressedPrintableChar


 / Published in: JavaScript
 

to use this function send in an ASCII character code (use my getKeyCode function) it will return true if the code corresponds to a printable character (not backspace code - 8, enter code - 13, or "undefined")

  1. function pressedPrintableChar(code) {
  2. if (code != 8 && code != 13 && code + "" != "undefined")
  3. return true;
  4. return false;
  5. }

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: MMDeveloper on March 25, 2009

what about punctuation and non-printable characters?

Posted By: jlvallelonga on March 26, 2009

I guess that the function should probably be named something else. punctuation returns true and non printable characters return false because the code should be "undefined" if you get the code from my getKeyCode function

You need to login to post a comment.