I am currently developing a calendar system with the Codeigniter framework. I want a div to be shown each time a day cell in the calendar template is clicked.
The divs are created by a php for loop and populated from the database in the following view file:
calendar_view.php
<div class="cal_container">
<?php echo $calendar; ?>
<div class="day_expanded_container">
<?php for ($i = 1; $i<=31; $i++):?>
<div class="day_expanded" id"<?php echo 'd'.$i;?>">
<?php if (isset($calendar_info[$i])):?>
<h2><?php echo $calendar_info[$i]['title'];?></h2>
<p><?php echo $calendar_info[$i]['text']?></p>
<?php else: ?>
<h2>No Data for this Date</h2>
<p>There is currently nothing planned for this Calendar date.</p>
<?php endif; ?>
</div>
<?php endfor;?>
</div>
</div>
The following jQuery is then applied:
scripts.js
$(document).ready(function(){
var divs = $('div.day_expanded_container > div').get();
var today = $(".today").attr("id");
$(divs).hide().filter('#d' + today).show();
$(".day").click(function() {
var selected = $(this).attr("id");
$(divs).hide().filter('#d' + selected).show();
});
});
However on loading the page the divs are all hidden, and clicking does not show at all.
All id’s etc are correct and I can’t find anything in the css that will over-ride. Is there something glaringly obvious that I am doing wrong ?
Thanks very much
You are missing an equals sign:
should be