Note that there are some explanatory texts on larger screens.

plurals
  1. PO.show() and .hide() commands not working correctly
    text
    copied!<p>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. </p> <p>The divs are created by a php for loop and populated from the database in the following view file:</p> <p>calendar_view.php</p> <pre><code> &lt;div class="cal_container"&gt; &lt;?php echo $calendar; ?&gt; &lt;div class="day_expanded_container"&gt; &lt;?php for ($i = 1; $i&lt;=31; $i++):?&gt; &lt;div class="day_expanded" id"&lt;?php echo 'd'.$i;?&gt;"&gt; &lt;?php if (isset($calendar_info[$i])):?&gt; &lt;h2&gt;&lt;?php echo $calendar_info[$i]['title'];?&gt;&lt;/h2&gt; &lt;p&gt;&lt;?php echo $calendar_info[$i]['text']?&gt;&lt;/p&gt; &lt;?php else: ?&gt; &lt;h2&gt;No Data for this Date&lt;/h2&gt; &lt;p&gt;There is currently nothing planned for this Calendar date.&lt;/p&gt; &lt;?php endif; ?&gt; &lt;/div&gt; &lt;?php endfor;?&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>The following jQuery is then applied: </p> <p>scripts.js</p> <pre><code>$(document).ready(function(){ var divs = $('div.day_expanded_container &gt; 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(); }); }); </code></pre> <p>However on loading the page the divs are all hidden, and clicking does not show at all.</p> <p>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 ? </p> <p>Thanks very much</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload