Can you select the script element that included the JavaScript?
<p>Is there a way to select the <code>script</code> element that included a particular script without giving it a known attribute of any sort?</p>

<p>This example will alert the window object because it's being called in the global context:</p>

<pre><code>&lt;script&gt;
  alert(this);
&lt;/script&gt;
</code></pre>

<p>This example wont work as the name of the script could change (for convenience i'm assuming jQuery is included):</p>

<pre><code>&lt;script type="text/javascript" src="/foo/bar/baz.js"&gt;&lt;/script&gt;
//baz.js
$('[src^="baz.js"]');
</code></pre>

<p>This example is sub-optimal as it relies on the <code>id</code> attribute:</p>

<pre><code>&lt;script type="text/javascript" id="foo"&gt;
  $('#foo');
&lt;/script&gt;
</code></pre>
