I have a span that is part of a JSON object and need to set it visible or invisible due to some config options.
I have the following code but I am struggling to make it work:
function isc_getsvldata() {
return JSON.stringify(
{
polygon_shading_template_hash:
{
AVAILABLE_3_NONE:
{
interior: 0x<%= System.Drawing.ColorTranslator.ToHtml(Config.ColourSoldout).TrimStart('#') %>,
border: 0x<%= System.Drawing.ColorTranslator.ToHtml(Config.ColourSoldout).TrimStart('#') %>,
poly_tool_tip_template:
<%= Config.ISCavailability ?"<br><span class='textBlack'> [% @1:((polygon.counters[1] * 100) / polygon.counters[0]); %]%</span>":"<span class='someotherclass'>Nothing</span>"%>
}
}
}
);
}
I have a span that is part of a JSON object and need to set it visible or invisible due to some config options.
I have the following code but I am struggling to make it work:
function isc_getsvldata() {
return JSON.stringify(
{
polygon_shading_template_hash:
{
AVAILABLE_3_NONE:
{
interior: 0x<%= System.Drawing.ColorTranslator.ToHtml(Config.ColourSoldout).TrimStart('#') %>,
border: 0x<%= System.Drawing.ColorTranslator.ToHtml(Config.ColourSoldout).TrimStart('#') %>,
poly_tool_tip_template:
<%= Config.ISCavailability ?"<br><span class='textBlack'> [% @1:((polygon.counters[1] * 100) / polygon.counters[0]); %]%</span>":"<span class='someotherclass'>Nothing</span>"%>
}
}
}
);
}
Share
Improve this question
edited Nov 7, 2022 at 12:35
gouessej
4,0754 gold badges38 silver badges74 bronze badges
asked Feb 16, 2012 at 11:48
Jack MJack M
2,5744 gold badges30 silver badges52 bronze badges
3
- 3 Ha? What does that code mean? – gdoron Commented Feb 16, 2012 at 11:50
- That is a code that return a text message depending on the availability(ISCavailability) flag being set to true or false. – Jack M Commented Feb 16, 2012 at 15:19
- I added and asp tags, because I assume you're working with those... – weltraumpirat Commented Feb 16, 2012 at 21:36
1 Answer
Reset to default 13I am not sure what Config.ISCavailability
does, but what you should not use the visible property. The end result you want is most likely something like either <span style="display: none">
or <span style="visibility: hidden">
.
The correcsponding displayed tags would then be <span style="display: block">
and <span style="visibility: visible">
.
If Config.ISCavailability
is a boolean, then I think you want something like this:
<span class="textBlack" style="visibility:<%= Config.ISCavailability ? "visible" : "hidden" %>">