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

149
Views
Cómo acceder al elemento HTML devuelto

Esta función define un elemento HTML. document.getElementById devuelve la función completa, no solo el elemento h1 como se esperaba. Cómo solo escribo lo que hay dentro de los dos ` (valor de retorno).

 function tokens() { return ` <h1>test</h1> `; } document.getElementById('tokens').innerHTML = tokens;
about 4 years ago · Juan Pablo Isaza
3 answers
Answer question

0

Cambio

 document.getElementById('tokens').innerHTML = tokens;

a

 document.getElementById('tokens').innerHTML = tokens();
about 4 years ago · Juan Pablo Isaza Report

0

Debe llamar a la función entre paréntesis () para que se ejecute y devuelva el resultado adecuado:

 document.getElementById('tokens').innerHTML = tokens();
about 4 years ago · Juan Pablo Isaza Report

0

Has escrito tokens como si fuera una variable. Como desea ejecutar una función, agregue () a tokens . Eso sería tokens() .

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!