Note that there are some explanatory texts on larger screens.

plurals
  1. POjQuery Code in included PHP pages
    primarykey
    data
    text
    <p>I am currently encountering a problem with PHP and jQuery.</p> <p>I have build a website like this:</p> <p>header.php - this is where all the css and js files are loaded. index.php - main page. sidemenu.php - this is the side menu, which is included in index.php</p> <p>Inside sidemenu.php I have this JS code:</p> <pre><code> &lt;script type="text/javascript"&gt; jQuery(document).ready(function($) { $(".more").live('click', function(){ $(this).next(".submenu").slideToggle(500); }); }); &lt;/script&gt; </code></pre> <p>Which should get the .more to slideToggle:</p> <pre><code>&lt;div class="twocol" id="side-menu"&gt; &lt;ul class="menu"&gt; &lt;li&gt;Dashboard&lt;/li&gt; &lt;li class="more"&gt;&lt;a href="#"&gt;Security Settings&lt;/a&gt; &lt;img src="images/dropdown-menu.png" align="right"&gt;&lt;/li&gt; &lt;ul class="submenu"&gt; &lt;li&gt;Blacklistings&lt;/li&gt; &lt;li&gt;New Membership Package&lt;/li&gt; &lt;/ul&gt; &lt;li class="more"&gt;&lt;a href="memberships.php"&gt;Memberships&lt;/a&gt; &lt;img src="images/dropdown-menu.png" align="right"&gt;&lt;/li&gt; &lt;ul class="submenu"&gt; &lt;li&gt;New Membership&lt;/li&gt; &lt;li&gt;New Membership Package&lt;/li&gt; &lt;/ul&gt; &lt;li&gt;Forums&lt;/li&gt; &lt;li&gt;Help Desk&lt;/li&gt; &lt;li class="help"&gt;Documentation&lt;/li&gt; &lt;/ul&gt; &lt;/div&gt;&lt;!-- END 2col --&gt; </code></pre> <p>Yet, nothing happens when I click the .more.</p> <p>Weird enough, if I just make a page with the source code of the three pages above, it works. </p> <p>What am I doing wrong?</p> <p>Thanks in advance.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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