Note that there are some explanatory texts on larger screens.

plurals
  1. POjQuery - can't get both imported file and own function working
    primarykey
    data
    text
    <p>First of all I'm far from being a web expert, so please bear my silliness !</p> <p>I use in one of my PHP files a menu using jQuery. It comes with an external .js file. Actually, this is the <em>gooeymenu</em>. I also use another function for my page.</p> <p>Thing is : whenever I try to use either my function or the menu alone, it works like a charm. But having both of them in my file ends up allowing only 1 to work.</p> <p>Here is what I have :</p> <pre><code>&lt;head&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt; &lt;/head&gt; &lt;body&gt; ----&gt; &lt;script src="jquery-1.8.3.min.js" type="text/javascript"&gt;&lt;/script&gt; &lt;script src="gooeymenu.js"&gt;&lt;/script&gt; &lt;link rel="stylesheet" type="text/css" href="gooeymenu.css" /&gt; &lt;ul id="gooeymenu3" class="underlinemenu"&gt; my list &lt;/ul&gt; &lt;script&gt; gooeymenu.setup({id:'gooeymenu3', fxtime:250}) &lt;/script&gt; &lt;script type="text/javascript"&gt; function myFunction(){...} &lt;/script&gt; </code></pre> <p>With the previous code, only the gooeymenu works. Calling my function from the PHP code doesn't trigger what it's supposed to do.</p> <p>Here comes now the other way :</p> <pre><code>&lt;head&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt; &lt;/head&gt; &lt;body&gt; &lt;script src="gooeymenu.js"&gt;&lt;/script&gt; ----&gt; &lt;script src="jquery-1.8.3.min.js" type="text/javascript"&gt;&lt;/script&gt; &lt;link rel="stylesheet" type="text/css" href="gooeymenu.css" /&gt; &lt;ul id="gooeymenu3" class="underlinemenu"&gt; my list &lt;/ul&gt; &lt;script&gt; gooeymenu.setup({id:'gooeymenu3', fxtime:250}) &lt;/script&gt; &lt;script type="text/javascript"&gt; function myFunction(){...} &lt;/script&gt; </code></pre> <p>And this time, my function works fine but not the menu (which is obvious as jQuery was not imported first, but it's meant to show my function DOES work when alone). Notice where the jquery.js has been imported in the 2 examples. Useless to say that I've tried every single combination, also having everything in the or even above it ...</p> <p>If any of you have an idea to save a poor soul, I'd be happy to hear it ! Thanks.</p> <p><strong>UPDATE ::</strong></p> <p>I do have a console error when my function doesn't work (triggered on an onClick from HTML)</p> <pre><code>Uncaught TypeError: Property '$' of object [object Window] is not a function myfunction onclick </code></pre> <p>As info here's what I do in my function (I know I could avoid jQuery, but I can't in my other page so this is not a solution) :</p> <pre><code>$("#adiv").html("..."); $("#adiv").fadeIn("slow"); </code></pre>
    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.
 

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