Home
> Javascript > Javascript function to only allow integers in the textbox
Javascript function to only allow integers in the textbox
Hi
try this example :-
function CheckTextBox(i) { if(i.value.length>0) { i.value = i.value.replace(/[^\d]+/g, ''); } }
In Code behind add this function to “onkeyup” event for TextBox
TextBox1.Attributes.Add(“onkeypress”, “CheckTextBox(this)”);
Good Luck
Categories: Javascript
Comments (0)
Trackbacks (0)
Leave a comment
Trackback
Recent Comments