onpaste not working in firefox

Posted on 2011-05-06
Medium Priority
Last Modified: 2013-12-07
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.getData('Text');
          if (isNaN(txt)) {
              alert('Please paste only numbers!');
              return false;

How can I make this function work in firefox also ?
Question by:asudhaa
  • 2
LVL 14

Accepted Solution

dejaanbu earned 2000 total points
ID: 35706876
LVL 14

Expert Comment

ID: 35706940
Or try with onchange event , There is no onpaste event for Firefox .. ofcourse, onchange will fire not only for pasting..

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Each password manager has its own problems in dealing with certain websites and their login methods. In Part 1, I review the Top 5 Password Managers that I've found to be the best. In Part 2 we'll look at which ones co-exist together and why it'…
Google currently has a new report that is in beta and coming soon to Webmaster Tool accounts. This Micro Tutorial will highlight new features for Google Webmaster Tools.
This Micro Tutorial will demonstrate how nuggets on the Web are formatted by using Chrome Developer Tools. These tools would not only view the site's CSS but it can also modify it and save the CSS to use on your own site.
Suggested Courses
Course of the Month8 days, 19 hours left to enroll

621 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question