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

147
Vistas
How do I get my prompt value to append to a unordered list using jquery?

I am attempting to get a prompt value to attach to an unordered list and I cannot seem to get it to work.

My button is:

<button onclick="nameP()">PLEASE CLICK</button>

Here is my jQuery/Java code:

function nameP() {
var name = prompt("Please enter your name"); 
document.getElementById("a").innerHTML = name;
$('#a').appendTo('ul')}

my unordered list is

<ul></ul>

thank you for any help

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You're trying to get the value from the anchor tag, that i'm not sure what it contains. But the code below will work as you want. It will take the name from the prompt box and then append that text to the unordered list

function nameP() {
  var name = prompt("Please enter your name"); 
  $('ul').append(name)
}
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