With the help of a Stack Overflow user named Michael, I was able to get this jsFiddle division to drop down properly. However, when I try to implement the JavaScript, CSS, and HTML, even into a new directory with only the jsFiddle code, I can’t get the divisions to drop down on click. It won’t show the content division at all, actually. What am I doing wrong?
I’m guessing that I’ve got to be implementing the JavaScript code wrong somehow.
The jsFiddle is http://jsfiddle.net/WeL6j/12/,
$(function() {
$('.action').click(function() {
var content = $(this).find('~ .content');
$(this).parent().parent().find('.content').not(content).hide('fast');
content.slideToggle('fast');
});
});
You need to include jQuery before you use it… a good way to ensure this is to put the
<script>tag that includes jQuery before you code. Or you can move your code to the bottom of the body just before</body>read more