私はjQueryを使い始めたばかりで、基本的な例にこだわっています。この例では Safari を使用しています。
01.js:
$(document).ready(function() {
$('div.poem-stanza').addclass('highlight');
});
first.html:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Through the Looking-Glass</title>
<link rel="stylesheet" href="script/01.css">
<script language="javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script>
<script language="javascript" src="01.js"></script>
</head>
<h1>Through the looking-Glass</h1>
<div class="author">by Lewis Caroll</div>
<div class="chapter" id="chapter-1">
<h2><class="chapter-title">1. Looking-Glass House</h2>
<p>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, <span class="spoken">"—for it's all in some language I don't know,"</span> she said to herself.</p>
<p>It was like this.</p>
<div class="poem">
<h3><class="poem-title">YKCOWREBBAJ</h3>
<div class="poem-stanza">
<div>Sevot yhtils eht dna ,gillirb sawT'</div>
<div>;ebaw eht ni elbmig dna eryg diD</div>
<div>, sevogorob eht erew ysmim llA</div>
<div>.ebargtuo shtar emom eht dnA</div>
</div>
</div>
<p>She puzzled over this for some time, but at last a bright thought struck her. <span class="spoken">"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."</span></p>
<p>This as the poem that Alice read.</p>
<div class="poem">
<h3 class="poem-title">JABBERWOCKY</h3>
<div class="poem-stanza">
<div>'Twas brillig, and the slithy toves</div>
<div>Did gyre and gimble in the wabe;</div>
<div>All mimsy were the borogoves,</div>
<div>And the mome raths outgrabe.</div>
</div>
</div>
</div>
<body>
</body>
</html>
Safari Web 開発キットでは、.addclass('highlight') で「jQuery: TypeError 'undefined'is not a function」というエラーが返され、要求した .js の実行に失敗しているようです。
誰かが私がここで間違っていることを教えてくれますか? 助けてくれてありがとう!