Mac OS 10.6, Chrome 34 및 jQuery 2.1.1을 실행하고 있습니다. 나는이 간단한 코드를 TutsPlus '30 일 jQuery 배우기 '에서 가져 왔습니다. jQuery에 버그가 있다고 주장합니다. 아니면 ... 말해 봐요! ;)Jquery -> Document.Ready -> 실행 안 함
이 작동하지 않습니다 :
<html>
<head>
<title> Does not work </title>
<script type="text/javascript" src="jquery-2.1.1.js"></script> //script is in root
<style>
.emphasis{font-weight: bold;}
</style>
<script>
$(document).ready(function()){$('li:first-child').addClass('emphasis');});
</script>
</head>
<body>
<ul>
<li>Hello</li>
<li>Hello 2</li>
<li>Hello 3</li>
</ul>
</body>
</html>
이 작동 :
<html>
<head>
<title> </title>
<script type="text/javascript" src="jquery-2.1.1.js"></script>
<style>
.emphasis{font-weight: bold;}
</style>
</head>
<body>
<ul>
<li>Hello</li>
<li>Hello 2</li>
<li>Hello 3</li>
</ul>
<script>
$('li:first-child').addClass('emphasis');
</script>
</body>
</html>
구문 오류'$ (문서) .ready (함수() { $ ('리 : 첫 아이'). addClass ('강조'); });'- 추가')' 'function())' –
안녕하세요. 답에 감사드립니다. 구문 검사가있는 편집기를 권해 주시겠습니까? – InnerOrchestra
많은 편집자가 있습니다 ... Dreamviewer는 내가 생각하는 것 중 하나가 될 수 있습니다 ... 또는 당신은 aptana가 있습니다 –