Mike D Mike D - 1 year ago 151
HTML Question

Kendo UI template loading with hidden elements

I have a kendo ui template that is loaded in my program, but I need one of the elements to be hidden, so I can use a button to toggle them hidden or shown at any time. I want to use a basic jQuery toggle command, but the issue is getting the elements to be in the correct state initially. Can anyone help me initialize ResultsObjectPartial and ResultsObject has hidden and shown?

Here is my template:

<script type="text/x-kendo-template" id="template">
<div id="details-container">

<textarea id="ResultsObjectPartial">
var partialResults;
Calculation to return a partial result
#= partialResults #
<textarea id="ResultsObject">
#: ResultObject #

<button type="button" id="toggleResults">Full/Partial</button>

Here is my jQuery:

$(document).on("click", "#toggleResults", function (e) {

Answer Source

I believe it should be as simple as:

<textarea id="ResultsObjectPartial" style="display: none">

What toggle() does is change the CSS display property, in the simplest case setting it to 'none' if it isn't set to that, or removing 'none' if it is. So setting it as 'none' in your html should give you the initial state you are after.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download