Quantcast
Channel: Active questions tagged html - Stack Overflow
Viewing all articles
Browse latest Browse all 67411

How to render Div Content based on value from javascript function

$
0
0

I have a scenario where the contents of the div are to be displayed as per the value returned from the java-script function

pseudo HTML:

<div>
if(true==myfunction())
{
<p>True is returned from the javascript function</p>
}
else
{
<p>False is returned from the javascript function</p>
}
</div>

pseudo javascript function

myFunction()
{
var x = false;

// Some code to decide value of x.

return x;
}

I am using Asp.net core, my Javacript code is present in site.js and html code is present in cshtml.

It would be very helpful is someone can suggest an approach on how to achieve this. Note: The code presented is not the actual code, but represents the actual scenario.


Viewing all articles
Browse latest Browse all 67411

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>