hi
currently I'm using:
Code:
$("a#test").live("click",function() {
$('div#test').toggle("fast");
$(this).css("border-bottom", "1px solid #813563")
});
Code:
<a href="#" class="test">Show Test</a>
<div id="test">Test..</div>
when I click the link, test div shows.
I'd like to have 4-5 links on the page, that, when clicked, show content for the appropriate div.
I was intending to copy and paste the above code and adjust the ID each time, but this seems so inelegant
is there a better way to achieve this? Assuming each link and its div share an ID or class.
so:
test1 link > show test1 div
test2 link > show test2 div
i'd also like to hide every other div, so only one is on display at a given time.
hope this makes sense, thanks.
resolved
http://stackoverflow.com/questions/1...657171#1657171
Code:
$(document).ready(function() {
$('.item > p > a').click(function(){
$('#details > div').hide(); // hide all of the divs
$('div.' + this.id).show("slow"); // then show the one with the
//same class as the link.id that was clicked
});
});