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

172
Vistas
How to properly pass variables in an array from a form using Javascript jquery

when I run the code below it works fine

<script>

var key_values =[79, 129, 183, 128, 66];
const secret_keys = new Uint8Array(key_values);
console.log(secret_keys);

//Uint8Array(64) [ 79, 129, 183, 128, 66 ]

</script>

Here is my issue:

when I pass the key_values variable into an arrays from form inputs. it does not display any value in the console.

This is what it displayed in the console Uint8Array [0] instead of Uint8Array(64) [ 79, 129, 183, 128, 66 ]

here is the code.

<script>
            $(function () {
                $('#save').click(function () {
                    
// inputted form values 79, 129, 183, 128, 66

var key_values = $('#my_keys').val();

const secret_keys = new Uint8Array([key_values]);
console.log(secret_keys);

//Uint8Array [0]



    });
            });
</script>
<input type="text" id="my_keys" value="79, 129, 183, 128, 66">

                    <input type="button" id="save" value="save" />
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You need to parse the string as an array before passing it to the constructor or just split by comma to get an array.

const secret_keys = new Uint8Array(key_values.split(","));
about 4 years ago · Juan Pablo Isaza 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