There's a method I'd like to use to dynamically add a div to the view using JavaScript.
I attempted hiding the div on page load and then showing it through JavaScript.
However, what ends up happening is that the div content appears briefly on load before being hidden by the JavaScript.
So, I've come up with a solution where I create a main div in the view like this:
<div id = "ManagerSection">
</div>
and insert my code into the div from JavaScript.
Here's the approach I tried:
function myfunction() {
document.getElementById("ManagerSection").innerHTML +=
"<h3>This text has been inserted by JS</h3>";
}
This successfully adds the text, but in my case, I need to add a more complex structure like this:
[complex HTML structure provided in example]
When I try to copy this into JavaScript within the double quotes, it gets interpreted as C# code within the JavaScript.
Is there a way to achieve this? Any suggestions?