I am trying learn to make a simple quiz.So I got a script in StackOverflow.It works here http://jsfiddle.net/Zy4gW/ ,but not when I use it ,here is my code
<html>
<head>
<title>Learning how to make a quiz</title>
<script type="text/javascript">
$(function(){
$('#q-and-a li a').each(function(){
$(this).click(function(){
$(this).siblings('div').slideToggle(300);
});
});
});
</script>
</head>
<body>
<ul id="q-and-a">
<li><a>Question One</a>
<div>Answer to Question One...</div>
</li>
<li><a>Question Two</a>
<div>Answer to Question Two...</div>
</li>
</ul>
<style>
ul { margin: 0; padding: 0; }
ul li { margin: 0; padding: 0; list-style: none; }
ul li a { color: blue; }
ul li div { display: none; }
</style>
</body>
</html>
Why doesn`t it run?