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

200
Views
How to set an variable as a link in HTML
inputBtn.addEventListener("click", function(){
    myLeads.push(inputEl.value)
    inputEl.value = ""
    let linksFromLocalStorage = localStorage.getItem("Leads")
    localStorage.setItem("Leads", JSON.stringify(myLeads))
    render(myLeads)
})

function render(Leads){
    let listItems = ""
    for(i = 0; i < Leads.length; i++){
        listItems += `
            <li>
                <a href='${Leads[i]}' target='_blank'> 
                    ${Leads[i]}
                </a>
            </li>`
    }
    ulEl.innerHTML = listItems
}

I have written these two codes but whenever I input a link for example "www.google.com" and then click on the link it does not go to google.com. It shows an error "ERR_FILE_NOT_FOUND" Does anybody know how I can fix this? I am really new to Javascript and HTML and would appreciate any help. Thanks in advance

about 4 years ago · Juan Pablo Isaza
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!