On Sep 29, 5:41 pm, Nik <[EMAIL PROTECTED]> wrote:
> Hello all,
>
> I am wishing to do something like this:
>
> $$('input.info').invoke('onkeydown', function(){...})
>
> is that possible?
>
> Basically, I want to limit all the input field with 'info' class to
> allow only alphabets, number , backspace and space with a custom
> function.
>
> Thank You!

Maybe something like this should do it:

$$('input.info').invoke('observe', 'keydown', function(e) {
  if (!(/^(\w|\s)+$/).test(String.fromCharCode(e.keyCode))) {
    e.stop();
  }
});

--
kangax
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" group.
To post to this group, send email to prototype-scriptaculous@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to