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

198
Views
How can I modify the name of an html file when clicking on a link?

I'm currently using an API which returns a lot of data and I want to be able to send the user to another page when they click on a name. Here's my Javascript:

const name = pokemon.name;
<a href="./${name}.html"> ${name} </a>

Where ${name} varies according to the name of the Pokemon.

The problem is that I want to create one HTML file with the same structure with the same Pokemon but different info. I know that it's possible because I have seen other sites with "/pokemonName" at the end of the URL in the address bar.

Edit : I'm using vanilla JS and the API is PokeApi

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

So you want something like this: https://dev.to/js_bits_bill/vanilla-js-who-s-that-pokemon-game-with-pokeapi-34m4

I see your example is exactly the same as the tutorial, the only issue is that you will notice that in the tutorial he is wrapping the html around backticks "`".

This is because those "${}" only works if wrapped in backticks.

You would need something like:

function pageHtmlString (name) {
  return `<button data-name="${name}">${name}</button>`;
};
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!