このスクリプトを実行するにはどうすればよいですか、html ファイルで実行しようとしましたが、うまくいかないようです..
このコードを単一の html ファイルにしたいのですが、可能ですか? それとも別のファイルが必要ですか? http://jsfiddle.net/ambiguous/jcnMa/1/
<script type="text/javascript">
$('.question, .answer')
.css("display", "none");
$('.section')
.click(function ()
{
var $others = $('.question:visible')
.not(this);
$others.next('.answer')
.hide();
$others.slideToggle(500);
$(this)
.next('.question')
.slideToggle(500);
});
$('.question')
.click(function ()
{
$(this)
.next('.answer')
.slideToggle(500);
});
</script>