Note that there are some explanatory texts on larger screens.

plurals
  1. PO2 includes in PHP Conflict in javascript .show()
    primarykey
    data
    text
    <p>I have a problem regarding javascript .hide() and .show() in "includes" of php. <br> It's kind of hard to explain but I'll show the code.</p> <p>Here is my <code>toogle_div.js</code></p> <pre><code>function toggleWalkin() { $('#walk_in').show(500); $('#reservation').hide(500); } function toggleReservation() { $('#reservation').show(500); $('#walk_in').hide(500); } </code></pre> <p>Here is my ToggleMenu()</p> <pre><code>function toggleMenu(){ var overlay = document.getElementById('overlay'); var specialBox = document.getElementById('contentbox'); overlay.style.opacity = .8; if(overlay.style.display == "block"){ overlay.style.display = "none"; specialBox.style.display = "none"; } else { overlay.style.display = "block"; specialBox.style.display = "block"; } </code></pre> <p>}</p> <p>Here is my html code: //Buttons to trigger the show and hide divs</p> <pre><code>&lt;a href="#" onclick="toggleMenu();"&gt;Walk-in&lt;/a&gt; &lt;a href="#" onclick="toggleMenu();"&gt;Reservation&lt;/a&gt; </code></pre> <p>//Content where the information will show</p> <pre><code> &lt;div id="button-header"&gt; &lt;ul&gt; &lt;li onmousedown="toggleWalkin();"&gt;Walk-in&lt;/li&gt; &lt;li onmousedown="toggleReservation();"&gt;Reservation&lt;/li&gt; &lt;li&gt;Seminar Conference Schedule&lt;/li&gt; &lt;li&gt;Guest Ledger&lt;/li&gt; &lt;li&gt;Guest Database&lt;/li&gt; &lt;li&gt;Unavailable Rooms&lt;/li&gt; &lt;li&gt;Report Generation&lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; &lt;div id="content"&gt; &lt;div id="walk_in"&gt; Walk in &lt;?php include "includes/navigation/walkin.php"; ?&gt; &lt;/div&gt; &lt;div id="reservation"&gt; &lt;?php include "includes/navigation/reservation.php"; ?&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>So basically, whenever I click <code>Walk-in</code> the <code>.show()</code> function worked. Yet if I clicked <code>Reservation</code>, <code>.show()</code> function won't work. I realized when I removed the include walkin of the php the reservation of the <code>.show()</code> function worked.</p> <p>In short, those 2 includes are basically conflicting the <code>.show()</code>.</p>
    singulars
    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.
 

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