This week's book giveaway is in the Programmer Certification forum.
We're giving away four copies of OCP Oracle Certified Professional Java SE 11 Programmer I Study Guide: Exam 1Z0-815 and have Jeanne Boyarsky & Scott Selikoff on-line!
See this thread for details.
Win a copy of OCP Oracle Certified Professional Java SE 11 Programmer I Study Guide: Exam 1Z0-815 this week in the Programmer Certification forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Paweł Baczyński
  • Piet Souris
  • Vijitha Kumara

input only numbers with HTML

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to input only numbers in HTML or javascript. What are different ways for this? Thanks.
 
Greenhorn
Posts: 2
Python Linux Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well basicly there are two ways. Javascript on keypress event or HTML5 number type. Look following tutorial.
Reference: https://www.poftut.com/html-text-input-allow-numeric-input/
 
Marshal
Posts: 66258
250
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ST: that looks promising. Both of you: welcome to the Ranch
 
Greenhorn
Posts: 25
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
(1) Need it more than once then use it as a function:


(2)At particular then use inline coding:



 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
in <!DOCTYPE html> you can directly use



And in javascript for validation you can make a function;






To know further validations you can refer or try below code for which i post a link:

https://jsfiddle.net/emkey08/zgvtjc51


 
Barry's not gonna like this. Barry's not gonna like this one bit. What is Barry's deal with tiny ads?
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!