Code: Select all
andCode: Select all
tags where approriate when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]
Hi,
I am using this function which will allow only decimals..Code: Select all
function decOnly(i) {
var t = i.value;
if(t.length>0) {
t = t.replace(/[^\d\.]+/g, '');
}
var s = t.split('.');
if(s.length>1) {
s[1] = s[0] + '.' + s[1];
s.shift(s);
}
i.value = s.join('');
}
<INPUT NAME="UnitPrice" maxlength="10" onChange="decOnly(this);" onKeyUp="decOnly(this);" onKeyPress="decOnly(this);">if i enter 22.30, it should remain same. i want to add decimals only in case when i enter integers.
If anything pls let me know.
Thanks
Weirdan | Please use
Code: Select all
andCode: Select all
tags where approriate when posting code. Read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url][/color]