Sorry if you don't understand what I need help with its very hard to say.
I am basically coding a forum system, in my forum system I want admins to be able to make a new category through the control panel, however the issue with this is that on each category I want to have arrows which slide the box up but how would I be able to add a piece of code that automatically creates a unique arrow and piece of JavaScript coding saying 'once the arrow is clicked the slide the box its in up'
Edit:
jsfiddle.net/UxJkA When you click on the second one the first one goes up and I know how to fix that by hand just by changing the classes but I want it too automatically change the classes of the arrow and box on each one.
Javascript code
$(document).ready(function(){
$("#a_main_content").show();
$('.arrow').click(function () {
$("#a_main_content").slideToggle();
});
$("#p_main_content").show();
$('.p_arrow').click(function () {
$("#p_main_content").slideToggle();
});
});
HTML code
<div id="bottom_corners"></div>
<!-- Main content box -->
<!-- Category 1 -->
<div id="p_content_header">
Category
<img src="images/arrow.png" class="p_arrow">
</div>
<div id="p_main_content">
<table>
<tr>
<td class="forum_name_header" style="width:240px;">Forum Name</td>
<td class="forum_name_header" style="width: 300px;">Last Post</td>
</tr>
<tr>
<td style="width:240px;" class="forum_name">James first forum<br />
<i style="color: #a3a3a3;">Topics: 858, Messages: 8,485</i></td>
<td style="width: 300px;" class="forum_name">Test 1<br />
by <b style="color: red;">Admin</b></td>
</tr>
<tr>
<td style="width:240px;" class="forum_name">James second forum<br />
<i style="color: #a3a3a3;">Topics: 434, Messages: 6,534</i></td>
<td style="width: 300px;" class="forum_name">Test 2<br />
by <b style="color: blue;">Mod</b></td>
</tr>
</table>
</div>
<div id="bottom_corners"></div>
<!-- Category 1 -->
<!-- Category 2 -->
<div id="p_content_header">
Category 2
<img src="images/arrow.png" class="p_arrow">
</div>
<div id="p_main_content">
<table>
<tr>
<td class="forum_name_header" style="width:240px;">Forum Name</td>
<td class="forum_name_header" style="width: 300px;">Last Post</td>
</tr>
<tr>
<td style="width:240px;" class="forum_name">James first forum<br />
<i style="color: #a3a3a3;">Topics: 858, Messages: 8,485</i></td>
<td style="width: 300px;" class="forum_name">Test 3<br />
by <b style="color: green;">Donator</b></td>
</tr>
<tr>
<td style="width:240px;" class="forum_name">James second forum<br />
<i style="color: #a3a3a3;">Topics: 434, Messages: 6,534</i></td>
<td style="width: 300px;" class="forum_name">Test 4<br />
by <b style="color: grey;">Registerd User</b></td>
</tr>
<tr>
<td style="width:240px;" class="forum_name">James second forum<br />
<i style="color: #a3a3a3;">Topics: 434, Messages: 6,534</i></td>
<td style="width: 300px;" class="forum_name">Test 5<br />
by <b style="color: #333;"><strike>Banned user</strike></b></td>
</tr>
</table>