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

122
Vistas
How to dynamically change themes after clicking a drop down menu of themes with vanilla javascript

enter image description hereI'm using bootstrap for the interface of the website I'm developing. I am also planning to integrate the bootswatch themes to my site. I have created a dropdown menu containing the different themes of bootswatch. My problem is how can I switch themes when I click one of the themes in the dropdown menu? Note that I want to do this with raw JavaScript without any special framework

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

0

Set your link with an id:

<link rel="stylesheet" id="dynamicCSS" type="text/css" href="mystyle1.css" />

Apply an onchange event to your select list:

<select id="myDropdownList" onchange="swapCSS()">
  <option>mystyle1.css</option>
  <option>mystyle2.css</option>
  <option>mystyle3.css</option>
</select>

Add your Javascript function:

const swapCSS = function()
{
  let selection = document.getElementById("myDropdownList").selectedOptions[0];
  document.getElementById("dynamicCSS").href = selection.value;
}
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