I have some markup like this:
<p><a id="1" href="#">Link 1</a></p>
<p id="1show" class="starthidden">Hi! I get shown when link 1 is clicked</p>
<p><a id="2" href="#">Link 2</a></p>
<p id="2show" class="starthidden">Hi! I get shown when link 2 is clicked</p>
<p><a id="3" href="#">Link 3</a></p>
<p id="3show" class="starthidden">Hi! I get shown when link 3 is clicked</p>
And some javascript like this:
$(document).ready(function(){
$("#maincontent a").click(function () {
var id = '#' + $(this).attr("id");
var show = id + 'show';
$("id").click(function () {
$("show").slideToggle("slow");
return false;
});
return false;
});
});
Now, id and show are both what I'd expect at runtime, but the next line doesn't work. I guess that it's the $("id") bit - though changing this to $(id) doesn't work either.
How do I fix this?