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

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

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 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