Search code examples
javascriptjquerynumericignore-case

JavaScript & HTML Forms Elements


Using the HTML Form Elements, I would like to allow an input of "numeric" and it's decimal seperator characters into a textfield (either textarea or an input type="text") - ONLY!

Any non-numeric character should be ignored with no appearance in the parent element whatsoever, and then I will use that particular value to submit in my database tables.

Is this achiveable with JavaScript with jQuery's support, or not?

Any solution is quite acceptable and welcome!

Thanks in forwards, lads.


Solution

  • I'm a big fan of setting my HTML up to use the browser's HTML5 input/form validation types and then adding support for the lesser browsers (i.e. IE) via jQuery plugins.

    Check this out: http://flowplayer.org/tools/validator/index.html