I am currently working on a project using Durandal. Within the HTML, I have both span and button elements. The challenge I am facing is that even though I have hidden the span elements in the HTML, I am unable to show them when needed through JavaScript. I came across a similar question on Stack Overflow (accessible via this link) where various solutions were suggested, but none of them worked for me.
In my attempts, I experimented with different ways of hiding the span element in the HTML like:
<span id="mySpan" hidden = "hidden">aaa</span>
or:
<span id="mySpan" style= "visibility:collapse">aaa</span>
or:
<span id="mySpan" style= "display:none">aaa</span>
and in the JavaScript side, I tried showing the element using:
$("#mySpan").show();
or:
$("#mySpan").css('visibility', 'visible');
Despite testing all possible combinations, none of them worked as intended.
Note: It's important to mention that if I do not hide the span from the HTML and use functions like toggle(), hide(), or show() in jQuery, they work perfectly fine.
For example, attempting to show a hidden span element:
within the HTML page:
<span id="mySpan" hidden = "hidden">aaa</span>
in the JavaScript section:
$("#mySpan").show();