EDIT: Thanks, but those answers are not the best way to do it and are difficult to understand by a beginner.
I have this structure:
<div>Title <a href="#" onclick="a1()">+</a>
<div id="b1">...content...</div></div>
..... n times this structure ....
<div>Title <a href="#" onclick="function aN()">+</a>
<div id="bN">...content...</div></div>
When the user clicks the + sign the content should show or disappear.
function a1(){
$('#b1').toggle();
}
.... too many functions .....
function aN(){
$('#bN').toggle();
}
How can I rewrite all those functions in one single function to write less code?