I have quite a simple jQuery toggle working here: http://jsfiddle.net/yVa3U/1/ – but I can’t work out how to get the active div to toggle off when the next div is clicked.
Any suggestions on how to do this?
Thanks
$(document).ready(function() {
$('.answer').hide();
$(".toggle").click(function(){
$("div[rel='profile_" + $(this).attr("profile") + "']").toggle(400);
});
});
You should add
before you call the
toggle()functionSide notes
$("div[rel='profile_" +to$(this).attr("profile") + "']").toggle(400);
$(this).next().toggle(400);profileyou should better use thedataattributeDemo