Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

193
Vistas
Configuración de pie de página de derechos de autor en JS

Estoy tratando de configurar el pie de página de Font Awesome con JS para poder agregarlo al pie de página, pero no puedo, porque aparece como [object HTMLElement] 2020 - 2021 . Importé el script para Font Awesome pero no funciona.

Me gustaría que el pie de página se muestre como © 2020 - 2021, pero en su lugar use el logotipo de Font Awesome.

 document.body.onload = footer; function footer() { // create a new div element const footerDiv = document.createElement("footer"); // assign it a class footerDiv.classList.add("footer"); // gets the current date const copyright = new Date().getFullYear(); // gets the copyright symbol const favicon = document.createElement("i"); favicon.classList.add("fas.fa-copyright"); const completedFooter = document.createTextNode(favicon + " 2020 " + "- " + copyright); // add the text node to the newly created div footerDiv.appendChild(completedFooter); // add the newly created element and its content into the DOM const newDiv = document.getElementById("div"); document.body.insertBefore(footerDiv, newDiv); }
 <head> <script defer src="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.14.0/js/all.min.js"> </script> </head>

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Debe agregar el elemento, no agregarlo como texto a un nodo de texto. También está agregando las clases incorrectamente al elemento i .

 document.body.onload = footer; function footer() { // create a new div element const footerDiv = document.createElement("footer"); // assign it a class footerDiv.classList.add("footer"); // gets the current date const copyright = new Date().getFullYear(); // gets the copyright symbol const favicon = document.createElement("i"); favicon.classList.add("fas", "fa-copyright"); const text = document.createTextNode(" 2020 " + "- " + copyright); // add the text node to the newly created div footerDiv.appendChild(favicon); footerDiv.appendChild(text); // add the newly created element and its content into the DOM const newDiv = document.getElementById("div"); document.body.insertBefore(footerDiv, newDiv); }
 <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css" rel="stylesheet"/>

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda