Note that there are some explanatory texts on larger screens.

plurals
  1. POjQuery: TypeError 'undefined'is not a function
    primarykey
    data
    text
    <p>I'm just starting out with jQuery and I'm stuck on a basic example. I'm using Safari for this example.</p> <p>01.js:</p> <pre><code>$(document).ready(function() { $('div.poem-stanza').addclass('highlight'); }); </code></pre> <p>first.html:</p> <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;head&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /&gt; &lt;title&gt;Through the Looking-Glass&lt;/title&gt; &lt;link rel="stylesheet" href="script/01.css"&gt; &lt;script language="javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"&gt;&lt;/script&gt; &lt;script language="javascript" src="01.js"&gt;&lt;/script&gt; &lt;/head&gt; &lt;h1&gt;Through the looking-Glass&lt;/h1&gt; &lt;div class="author"&gt;by Lewis Caroll&lt;/div&gt; &lt;div class="chapter" id="chapter-1"&gt; &lt;h2&gt;&lt;class="chapter-title"&gt;1. Looking-Glass House&lt;/h2&gt; &lt;p&gt;There was a book lying near Alice on the table, and while she sat watching the White Kind (for she was still a little anxious about him, in case he fainted again), she turned over the leaves, to find some part that she could read, &lt;span class="spoken"&gt;"&amp;mdash;for it's all in some language I don't know,"&lt;/span&gt; she said to herself.&lt;/p&gt; &lt;p&gt;It was like this.&lt;/p&gt; &lt;div class="poem"&gt; &lt;h3&gt;&lt;class="poem-title"&gt;YKCOWREBBAJ&lt;/h3&gt; &lt;div class="poem-stanza"&gt; &lt;div&gt;Sevot yhtils eht dna ,gillirb sawT'&lt;/div&gt; &lt;div&gt;;ebaw eht ni elbmig dna eryg diD&lt;/div&gt; &lt;div&gt;, sevogorob eht erew ysmim llA&lt;/div&gt; &lt;div&gt;.ebargtuo shtar emom eht dnA&lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;p&gt;She puzzled over this for some time, but at last a bright thought struck her. &lt;span class="spoken"&gt;"Why, it's a looking-glass book, of course! And if I hold it up against a glass, the words will al go the right way again."&lt;/span&gt;&lt;/p&gt; &lt;p&gt;This as the poem that Alice read.&lt;/p&gt; &lt;div class="poem"&gt; &lt;h3 class="poem-title"&gt;JABBERWOCKY&lt;/h3&gt; &lt;div class="poem-stanza"&gt; &lt;div&gt;'Twas brillig, and the slithy toves&lt;/div&gt; &lt;div&gt;Did gyre and gimble in the wabe;&lt;/div&gt; &lt;div&gt;All mimsy were the borogoves,&lt;/div&gt; &lt;div&gt;And the mome raths outgrabe.&lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;body&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>In the Safari webdevelopment kit, I get the error "jQuery: TypeError 'undefined'is not a function" returned on .addclass('highlight'), and it seems to fail to run the .js I requested.</p> <p>Can somebody enlighten me on what I'm doing wrong here! Thanks for the help!</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.
 

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