Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

238
Views
can't focus next input field using ascii 46 `.` (period)

I have a form with 4 text boxes for IPv4 addy entry that I want to have focus move to the next text field when the user presses the period ascii # 46.

The following JS/jQ (which I basically lifted from: Move Cursor to next text Field pressing Enter) works for ascii codes for enter (13), esc, and even the space char (32):

<script language ="javascript" type="text/javascript" >
    function ipfNext() {
      //alert( 'FUNC ipfNext' );
      $( document ).ready( function()  {
        $( '#formContent .inputTextIpf').keydown( function( e )  {
          if( e.keyCode == 46 ) {
            $( ':input:eq(' + ( $( ':input' ).index( this ) + 1 ) + ')' ).focus();
            return false;
          } // close IF 
        }); // close FUNC e
      }); // close docReady FUNC
    } // close FUNF ipfNext
  </script>

but it doesn't seem to fire for regular printing ascii codes like 46 .. How can the code be modified to allow regular ascii printing chars to initiate the field tab when pressed?

HTML input field that fires fine with ascii control chars but not printing chars

<input type="text" id="ipf1" name="ipf1" class="inputTextIpf" maxlength="3" onkeyup="return ipfNext();" value=
        <?php
        if ( !empty( $_SESSION[ 'ipf1' ] ) ) {
          echo '"' . $_SESSION[ 'ipf1' ] . '"> . ';
        } else {
          echo '""> . ';
        } // close IF
      ?>
over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Referring to: https://www.cambiaresearch.com/articles/15/javascript-char-codes-key-codes, the keycode for period . is 190 and not 46. The keycode for 46 refers to the DEL key according to the same page.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!