Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

249
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda