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

210
Vistas
How can I show and hide text and image in an onclick function?

I am using bootstrap 4.3.1 and would like to have a clickable icon in my list of thumbnails for a text. I have a function where I click on the thumbnails and these images are displayed in large size next to them. Now I want to have the same thing for my text.

Here is the code:

function myFunction(imgs) {
  var expandImg = document.getElementById("expandedImg");
  var imgText = document.getElementById("imgtext");
  expandImg.src = imgs.src;
  //imgText.innerHTML = imgs.alt;
  expandImg.parentElement.style.display = "block";
}
<!--START Thumbnaill Navbar-->
<div style="overflow-y: auto; height: auto; width: 170px;">
  <img src="../image" alt="###" class="img-thumbnail border-0 img-thumbnail-desktop" onclick="myFunction(this);">

  <!--Here the icon for text -->

</div>
<!--END Thumbnaill Navbar-->

<!--Main Content-->
<div class="container expandedImgSize d-flex justify-content-center ">
  <span onclick="this.parentElement.style.display='none'"></span>
  <img class="img-fluid" id="expandedImg" src="../PlaceholderImage">
  </div>

Is there a elegant solution to show just the text? I'll try my best but i will probably need help from you guys ( 〃 ω〃)

Thanks you guys in advance!

about 4 years ago · Juan Pablo Isaza
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