I am getting the error message UndefinedError: 'mod' is undefined
In this scenario, card
is always between 0 and 51.
Notice there is a base.html
template involved.
Where do I put the javascript in the following situation or can I construct it differently?
Javascript:
numbers = ['2', '3', '4', '5', '6', '7', '8', '9', '10', 'J', 'Q', 'K', 'A']
suits = ['S','H','D','C']
function mod(card){
return numbers[card%13]+suits[card%4]
}
HTML:
{% for card in cardlist %}
<input type="radio" class="btn" name="person" value="{{ card }}"/>
{%set temp=mod(card)%}temp
{% endfor %}
base.html
<html>
<head>
{% block head %}
<link rel="shortcut icon" href="/static/images/favicon.ico" type="image/x-icon" />
<link rel="icon" href="/static/images/favicon.ico" type="image/x-icon">
<title>{% block title %}{% endblock %} - BridgeToGo</title>
{% endblock %}
</head>
<body>
<script>
function goBack() {
window.history.go(-1);
}
</script>
</body>
</html>