PricingBlog

Best way to hide without removing from DOM

  • _.__._.__.__._-1503726763690299492

    Ethan

    23 hours 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-1503726765112037411

    Tod

    23 hours ago

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

    salma

    23 hours 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
  • _.__._.__.__._-1503738219919835228

    Ethan

    22 hours ago

    Thank you!
    👍1