Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

244
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda