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

334
Views
Cómo agregar iconos de FontAwesome al botón a través de JavaScript

Quiero agregar una etiqueta i al botón. Básicamente, quiero agregar el ícono FontAwesome a un botón, pero cuando lo estoy agregando, aparece como una cadena. Aquí está mi código:

 <script> function Draw_Button() { var downloadButton = document.createElement("button"); downloadButton.textContent = '<i class="fa-solid fa-arrow-down-to-line"></i>'; downloadButton.style.borderRadius = "100%"; downloadButton.style.backgroundColor = "orange"; downloadButton.style.width = "50px"; downloadButton.style.height = "50px"; downloadButton.style.fontSize = "14px"; downloadButton.style.position = "relative"; downloadButton.style.float = "right"; downloadButton.style.bottom = "55px"; } </script>
about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

Quizás use .innerHTML en lugar de contenido de texto. Como textContent genera una cadena, pero desea incluir html

about 4 years ago · Juan Pablo Isaza Report

0

Tienes que usar .innerHTML. Ver el código a continuación

 downloadButton.innerHTML = "<i class='fa-solid fa-arrow-down-to-line'></i>";

no olvide agregar el botón al cuerpo de su documento

 document.body.appendChild(downloadButton);
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!