asudhaa
asked on
onpaste not working in firefox
I have dynamically created textboxex,in which I would like to enter only numbers.This works fine.I would like to paste only numbers.This works in internet explorer .But in firefox i am able to paste text also. I have used the following code
in C#
tb.Attributes.Add("onpaste ", "return alloNumbersOnly(this);");/ /paste only nembers
in aspx
<script type="text/javascript">
function alloNumbersOnly(obj) {
var txt = window.clipboardData.getDa ta('Text') ;
if (isNaN(txt)) {
alert('Please paste only numbers!');
return false;
}
}
</script>
How can I make this function work in firefox also ?
in C#
tb.Attributes.Add("onpaste
in aspx
<script type="text/javascript">
function alloNumbersOnly(obj) {
var txt = window.clipboardData.getDa
if (isNaN(txt)) {
alert('Please paste only numbers!');
return false;
}
}
</script>
How can I make this function work in firefox also ?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Or try with onchange event , There is no onpaste event for Firefox .. ofcourse, onchange will fire not only for pasting..