Live Chat Icon For mobile
Live Chat Icon

How do you conditionally hide the DOM elements?

Platform: Blazor| Category : Data binding, Tips and Tricks

DOM elements are hidden using the hidden attribute. You can conditionally use any .NET parameter to set this attribute to hide the DOM elements.

@page "/"
   <p hidden="@IsShow">I am Blazor</p>
   <button @onclick="@Show">Show/Hide</button>
 @code {
       private bool IsShow   {get;set;} = false;
       private void Show()
           IsShow =   !IsShow;

Share with

Related FAQs

Couldn't find the FAQs you're looking for?

Please submit your question and answer.