James Birkett
08-04-2009, 09:50 PM
I'm coding a spoiler using jQuery. I have an error though.
I know the error, I just can't re-code it to fix it! Frustration :(
<style type="text/css">
p#spoilercontent{
display:none;
}
</style>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript">
$(function() {
$('p#spoiler').click(function() {
$('p#spoilercontent').toggle(400);
});
});
</script>
<div align="center">
<strong><p id="spoiler"><u>Spoiler:</u></strong><br />
<p id="spoilercontent">{param}</p>
</div>
That's my code, and the problem is it's controlling all spoilers not that one. I need to use $(this). but I can't re-code it to use that.
Any help is appreciated.
I know the error, I just can't re-code it to fix it! Frustration :(
<style type="text/css">
p#spoilercontent{
display:none;
}
</style>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript">
$(function() {
$('p#spoiler').click(function() {
$('p#spoilercontent').toggle(400);
});
});
</script>
<div align="center">
<strong><p id="spoiler"><u>Spoiler:</u></strong><br />
<p id="spoilercontent">{param}</p>
</div>
That's my code, and the problem is it's controlling all spoilers not that one. I need to use $(this). but I can't re-code it to use that.
Any help is appreciated.