I've read a lot of the documentation available on using Javascript with Drupal, but haven't found an answer to this question.
I have a custom content type (created via CCK) that has a 4-character "job number" field. I have it validating on submit, but I want a further level of assurance by not allowing the user to even type in anything beside numbers. I have the following function defined in a custom js:
<script type="text/javascript">
function numbersOnly(el)
{
el.value = el.value.replace(/[^0-9]/g, "");
}
</script>
If I was working with a plain html file, I would at this point simply add "onkeyup="numbersOnly(this)"" to the input I want to filter and be done. However, I don't know where / how this is done in Drupal.
Can anyone point me in the right direction? Thanks!
Revision:
What I don't know is where the "input" tag is rendered by the system. Can anyone help?