Question

Is there any way by which I can enable onkeypress event in opera mini for mobile? its working in almost all browser but not in opera mini.

My code is:

 <pre>
    <script type="text/javascript">        
    function doCheck(field) {
      if (isNaN(document.getElementById(field).value)) {
        alert('This is not a number! Please enter a valid number before submitting the form.');
        document.getElementById(field).focus();
        document.getElementById(field).select(); 
        return false;
      }else {
        return true;
      }
    }

    function abc(){         
      var a;
      a = document.getElementById('inp').value;        
      if(isNaN(a)){
        alert("you can write only numbers");
        document.getElementById('inp').value = "";
      }
    }
    </script>        
  </pre>
Was it helpful?

Solution

as far as i know, Opera Mini only has limited JS support (and onKeyPress isn't one of them)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top