Created
February 7, 2015 16:02
-
-
Save jumbojet/77418851af2e3be18921 to your computer and use it in GitHub Desktop.
Conditional Execution
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
// Lets think template_variable is a django template variable | |
var is_condtion = {% if template_variable %}true{% else %}false{% endif %}; | |
if (is_condtion == false) | |
{ | |
alert("Execute this code if is_condition is true"); | |
// For example | |
<div> Hello How are you </div> | |
} | |
else | |
{ | |
alert("Execute this code if is_condition is false"); | |
$("#divTest").html("Hello World"); | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment