JSFiddle - React, Tailwind, and code Playground
by Nick Craver
HTML
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/dot-luv/jquery-ui.css">
<script src="http://github.com/jquery/jquery-tmpl/raw/master/jquery.tmpl.js"></script>
<p id="results"></p>
<p>How do you test if the Value exists and is false?</p>
<script id="testTemplate" type="text/html">
Test ${Test}:
{{if Value}}
Value exists and is true
{{else typeof Value != "undefined" && Value === false}}
Value exists and is false
{{else}}
Value doesn't exist or isn't explicitly false
{{/if}}
<br/>
</script>
JavaScript
$(document).ready(function() {
$("#testTemplate").tmpl({Test:1}).appendTo("#results");
$("#testTemplate").tmpl({Test:2, Value:true}).appendTo("#results");
$("#testTemplate").tmpl({Test:3, Value:false}).appendTo("#results");
});