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

182
Vistas
x-cloak issue in Alpine JS and Phoenix(PETAL stack)

Im a newbie to JS and Phoenix (PETAL stack in general).Problem raised when I want to implement hidden content with Alpine JS. Here`s some code:

<div x-data="{ open: false }">
    <button @click=" open = ! open ">toggle</button>
    <div x-show="open" class="text-center" x-cloak>
       <p>content</p>
    </div>
</div>

So my idea is to show the content only when a user clicks the show button. But when I load the page the content is visible and I need to press the button twice to hide it. I tried to use x-cloak and x-if. Maybe Alpine does not work right for some reason in my project?

P.S. I added in root layout style, but still can`t get the right output

[x-cloak] { display: none !important; }
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