Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

150
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!