JQuery class selectors
<p>I have an html text box with some having class names as <strong>numbers</strong></p>

<pre><code>&lt;input type="text" name="msg_timeout" class="numbers" /&gt;
</code></pre>

<p>similarly there are different text box with class as <strong>numbers</strong>.I want to assign keydown event to those text box that has class as number so i tried with following ,but not working</p>

<pre><code>$('input.numbers').each

$('.numbers').each

$('input.numbers:text').each

$('input:text.numbers').each

$('input[type=text]').each  // only this is working but it selects all textboxes.
</code></pre>

<p>kindly let me know idea.  <strong>CODE BELOW</strong></p>

<pre><code>$(document).ready(function() {


    $('input.numbers').each(function() {

        $(this).get(0).oncontextmenu = function() { return false; };
           $(this).bind("keydown",function(event) {
           // alert(window.event);

            // Allow only backspace and delete
            if ( event.keyCode == 46 || event.keyCode == 8  
                    &amp;&amp; (event.keyCode &gt;=96 &amp;&amp; event.keyCode &lt;=105) ) 
            {
                // let it happen, don't do anything
            }
            else {
                // Ensure that it is a number and stop the keypress
                if (event.keyCode &lt; 48 || event.keyCode &gt; 57 || event.shiftKey || event.ctrlKey || event.altKey ) {
                    event.preventDefault(); 
                }   
            }

            var forbiddenKeys = new Array('c', 'x', 'v');
            var keyCode = (event.keyCode) ? event.keyCode : event.which;
            var isCtrl;
            isCtrl = event.ctrlKey;
            if (isCtrl) {
                for (i = 0; i &lt; forbiddenKeys.length; i++) {
                    if (forbiddenKeys[i] == String.fromCharCode(keyCode).toLowerCase()) {
                        //alert('You are prompted to type this twice for a reason!');
                        return false;
                    }
                }
            }
            return true;
        });
   });

});
</code></pre>
