?
Solved

Restricting Input in HTML Textboxes to Numeric Values

Posted on 2014-12-04
2
Medium Priority
?
87 Views
Last Modified: 2014-12-11
Restricting Input in HTML Textboxes to Numeric Values
0
Comment
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 82

Accepted Solution

by:
leakim971 earned 2000 total points
ID: 40482582
Test page : http://jsfiddle.net/uz1xweoh/

$("#THISISMYID").on("keyup blur focus paste", function() { 
      $(this).val( $(this).val().replace(/\D/g,"") );
});

Open in new window

0
 
LVL 10

Expert Comment

by:Hans Langer
ID: 40482814
If you are using jquery would recommend you this plugin. its works to validate the most common formats, money, date, etc..
http://digitalbush.com/projects/masked-input-plugin
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article you'll learn how to use Ajax calls within your CodeIgniter application. To explain this, I'll illustrate how to implement a simple contact form to allow visitors to send you an email through your web site.
Introduction JSON is an acronym for JavaScript Object Notation.  It is a text-string data transport mechanism, capable of representing simple or complex data structures in a consistent and easy-to-read manner.  Similar in concept to XML, but more e…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

801 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question