Click here to Skip to main content
15,897,226 members
Articles / Web Development / HTML

Text box to accept only number

Rate me:
Please Sign up or sign in to vote.
5.00/5 (8 votes)
27 Dec 2011CPOL 55.8K   7  
Here is a really simple code for a numeric text box and it will work in all browsers. Only works for web applications. function CheckNumeric(e) { if (window.event) //...

Alternatives

Members may post updates or alternatives to this current article in order to show different approaches or add new features.

Please Sign up or sign in to vote.
28 Apr 2011pankajupadhyay29
I have created a jQuery code to achieve this/*User Options --allowHex:Allow hexadecimal number default falseallowNeg:Allow negative default falseonlyInteger:did not allow decimal default true*/$(function () { var mergedOptions = {}; var common = { allowHex:...
Please Sign up or sign in to vote.
24 Apr 2011Sander Rossel
The following Class is a TextBox for WinForms that only accepts 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 (numerics) or backspace as input. Not using regular expressions.using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Windows.Forms;namespace...
Please Sign up or sign in to vote.
23 Apr 2011Prasanta_Prince 4 alternatives  
Text box to accept only number
Please Sign up or sign in to vote.
29 Dec 2011Manish K. Agarwal
WinForms TextBox to accept numbers in a range[^]

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer
India India
I am working as software engineer since last 3.5 year.
i am working in .net technologies.

Comments and Discussions