Hi
In below Html i want if value is not null or false in ChildAdopted then it should not be displayed else displayed
Code
Child adoptedThanks
Hi
In below Html i want if value is not null or false in ChildAdopted then it should not be displayed else displayed
Child adoptedThanks
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Aman GuptaRank #193 · 12.4K reputationPosted Jul 17, 2024, 4:15 AM EDT
Hi Ramco,
You can go with below approaches.
Using JavaScript
You can use JavaScript to check the value of ChildAdopted and conditionally display the label.
Child adopted var ChildAdopted = false; // This should be set dynamically based on your application logic if (ChildAdopted) { document.getElementById('child-adopted-label').style.display = 'block'; }Using a Templating Engine (e.g., EJS, Handlebars)
If you are using a templating engine, you can conditionally render the label directly in your template.
Example with EJS:
Example with Handlebars:
Using React
If you are using React, you can conditionally render the label in your component.
import React from 'react'; const MyComponent = ({ ChildAdopted }) => ( {ChildAdopted && ( Child adopted )} ); export default MyComponent;Choose the method that best fits your setup and project structure.
Vishal JoshiRank #377 · 6.7K reputationPosted Jul 17, 2024, 5:00 AM EDT
Hello Ramco,
You can use ngIf for dynamic conditions to show or hide the content. try the below code.
Thanks
Vishal Joshi