Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy isn't RequireJS passing jQuery into the functions alias?
    text
    copied!<p>I downloaded the <a href="http://requirejs.org/docs/download.html#samplejquery"><strong>sample-project</strong></a> for the <a href="http://requirejs.org/docs/download.html#latest"><strong>latest-release</strong></a> of <a href="http://requirejs.org/"><strong><code>RequireJS</code></strong></a>. Their <a href="http://requirejs.org/docs/api.html#jsfiles"><strong>documentation implies</strong></a> anything loaded is passed-into the parameter list of the associated function (in corresponding order).</p> <p>So I decided to try it...but it doesn't seem to work! </p> <ul> <li><code>Firebug</code> (net tab) shows <code>jQuery</code> as being loaded: so <code>RequireJS</code> obvioulsy did that part successfully</li> <li><code>Firebug</code> (console tab) shows '$ is not a function'</li> </ul> <p><strong>My question is:</strong> Why isn't the alias getting populated?</p> <p><strong>MY CODE LOOKS LIKE:</strong><br/></p> <pre><code>&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;head runat="server"&gt; &lt;title&gt;&lt;/title&gt; &lt;script src="Scripts/require.js" type="text/javascript"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; require(["scripts/jQuery/Core/jquery-1.7.2.min"], function ($) { // jQuery is not passed-into the function, so the alias fails! $(function () { var stop = ""; }); }); &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;form id="form1" runat="server"&gt; &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p><strong>THIER SAMPLE LOOKS LIKE:</strong><br/></p> <pre><code>//Inside scripts/main.js require(["some/module", "a.js", "b.js"], function(someModule) { //... }); </code></pre>
 

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