Reputation: 2234
I need make input field that contain phone numbers. Users can enter 1-10 numbers. I found almost suitable jQuery plugin. But it's searching from pre-existed datas. In my case there aren't any existed database. Users just fill numbers and commas. For example:
99889966, 88554477, 89879856 etc.
Please look below url and suggest me similar plugin which comfortable with my case.
http://loopj.com/jquery-tokeninput/demo.html
Upvotes: 0
Views: 1590
Reputation: 807
Or you can simply use this code.
$("#txtPhNo").keypress(function (event) {
// 32 - Space, 44 - comma, between 47 to 59 are numbers
if (event.which != 32 && event.which != 44 && (event.which < 47 || event.which > 59)) {
event.preventDefault();
}
});
This code is very basic. You can do more tricks by adding features to this.
Upvotes: 0