I am building a calendar application and I'm trying to figure out if Jinja (or if there is a way to do that simply with HTML), can fetch the value of a specific div to use it for comparisons.
Be the following code, in the head of the table, for each span id="day", I've written the current date of that day in the format YYYY/MM/DD.
Functions back() and advance() moves the week from another one.
Inside the body of the table, I am triggering various comparisons with event['Start date'], which contains a date of similar structure.
Is it possible, to fetch the value of id="day" from the head and use it in jinja's comparisons ?
{% set times = ["00", "02", "04", "06", "08", "10", "12", "14", "16", "18", "20", "22"] %}
<div id="calendar">
<div class="header">
<ul>
<button class="prev" onclick="back()">❮</button>
<button class="next" onclick="advance()">❯</button>
<span style="font-size:18px" id="day"></span>
<span style="font-size:18px" id="datetime"></span>
</ul>
</div>
<table>
<thead>
<tr>
<th></th>
<th>Monday <span id="monday"></span></th>
<th>Tuesday <span id="tuesday"></span></th>
<th>Wednesday <span id="wednesday"></span></th>
<th>Thursday <span id="thursday"></span></th>
<th>Friday <span id="friday"></span></th>
<th>Saturday <span id="saturday"></span></th>
<th>Sunday <span id="sunday"></span></th>
</tr>
</thead>
<tbody>
{% for time in times %}
<tr>
<td>{{ time }}</td>
<td>
{% if event['Start date'][11:13] == time %}
{% if event['Day'] == 0 %}
{{ event['Name'] }}
{{ event['Start date'][11:13] }}
{% endif %}
{% endif %}
</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
Thanks,
Jinja does not appear to be able to straight up use {{ (id of span).value == something %}.