BlueIshDan
☠
- Local time
- Today, 15:49
- Joined
- May 15, 2014
- Messages
- 1,122
I'm currently diving into the complicated ways of web design by trying to create a forum from scratch.
My problem is I cannot figure out how to hide table rows using JQuery.
My thoughts are the problem lies within the fact that the button resides in a table row?
I'm coming to you because I'm getting no errors thrown by Chrome's console & Response information =/
Yes: JQuery is referenced.
Anywho here is the body code.
My problem is I cannot figure out how to hide table rows using JQuery.
My thoughts are the problem lies within the fact that the button resides in a table row?
I'm coming to you because I'm getting no errors thrown by Chrome's console & Response information =/
Yes: JQuery is referenced.
Anywho here is the body code.
PHP:
@functions{
public int GetGroupID(){
int group_id = 0;
if(Session["logged_in"] == "YES"){
group_id = Convert.ToInt32(
Database.Open("forum")
.QueryValue("SELECT user_group_id FROM users WHERE ID = @0", Session["user_id"]));
}
return group_id;
}
}
@{
var db = Database.Open("Forum");
}
<div id="area_group">
<table style="width=100%">
<thead>
<tr>
</tr>
</thead>
<tbody>
@{
foreach (var area_group in db.Query("SELECT * FROM area_groups WHERE user_group_id >= " + GetGroupID())){
<tr><td>
<table id="area_group_@area_group.name.Replace(" ", "")">
<tbody>
<tr>
<td>@area_group.name
<input style="
position: absolute ;
right: 15px;
height: 20px"
type="button"
id="hide_@area_group.name.Replace(" ", "")"/>
<input style="
position: absolute ;
right: 30px;
height: 20px"
type="button"
id="show_@area_group.name.Replace(" ", "")"/>
</td></tr>
@{
foreach (var area in db.Query("SELECT * FROM areas WHERE area_group_id=@0", area_group.ID)){
<tr><td><a href="Area.cshtml?area=@area.name">@area.name</a></td><td>@db.QueryValue("SELECT COUNT(*) FROM threads WHERE area_id=@0", area.ID)</td></tr>
}
}
</tbody>
</table>
</td></tr>
}
}
</tbody>
</table>
</div>
@{
foreach (var area_group in db.Query("SELECT * FROM area_groups WHERE user_group_id >= " + GetGroupID())){
<script type='text/javascript'>
var rows = $('table.area_group_@area_group.name.Replace(" ", "") tr');
$('#hide_@area_group.name.Replace(" ", "")').click(function() {
rows.hide();
});
$('#show_@area_group.name.Replace(" ", "")').click(function() {
rows.show();
});
</script>
}
}