Can be used to show/hide DOM elements. Similar to using if
, except that visible
will still build the element and set display:none
.
<div data-bind="visible: shouldShowMessage">
You will see this message only when "shouldShowMessage" holds a true value.
</div>
<script type="text/javascript">
var viewModel = {
shouldShowMessage: ko.observable(true);
};
</script>