Help forum

Best way to hide without removing from DOM

  • Ethan

    6 months ago

    Hi all, what would be the best way to hide an element based on a condition while keeping it inside the DOM (If my understanding is correct, show/hide removes it from the DOM entirely). I have an element that i want to hide but still need to access it in an action while hidden. (Its a hidden canvas that is written to. I want to show that canvas when it is complete. This is for taking a photo)

    Many thanks
    ✅1
  • Tod

    6 months ago

    Great job @Ethan! Your contribution to the Nordcraft Community just made you advance to Community Level 6! 🌲
  • salma

    6 months ago

    You can use a CSS class on that element to determine whether an e.g. "hidden" class is applied to the element where you use CSS to hide it.
  • I'm releasing a video on this topic tomorrow, but in the meantime, https://docs.nordcraft.com/styling/conditional-styles#class-based-styles
  • Ethan

    6 months ago

    Thank you!
    👍1