jQuery - Only Numbers in the input(textbox) field.
jQuery code that changes the input to accept just numbers.How it looks like:
http://jsfiddle.net/rogeriohsjr/cye3Lh33/
Code Example:
jQuery(document).ready(function () { ApplyNumberAllFields(); }); function ApplyNumberAllFields() { var objListValue = GetFields(); for (var i = 0; i != objListValue.length; i++) { jQuery(objListValue[i]).keypress(function (event) { return /\d/.test(String.fromCharCode(event.keyCode)); }); } } function GetFields() { var objListObjects = []; objListObjects.push("#txtNumber1"); objListObjects.push("#txtNumber2"); objListObjects.push("#txtNumber3"); return objListObjects; }
Nenhum comentário:
Postar um comentário