朋友A和B是团体名称,我在左侧表中列出了俱乐部,当用户可以双击俱乐部然后从左表中删除俱乐部,我根据点击的单选按钮在右侧表添加俱乐部请帮助我的朋友我不需要在右边的桌子上添加黑色空间
我的Html代码:
<table class="tabledesign" id="Table1" border="1px" cellspacing="0" cellpadding="10" width="650px">
<tr></tr>
<tr>
<% foreach (var item in Model.Groups)
{ %>
<td class="Group">
<input id="Recipt" type="radio" class="GroupName" name="GroupName" value="<%: item.GroupName %>" /> <%: item.GroupName %>
</td>
<%} %>
</tr>
</table>
<div style="width: 240px;height: 300px; over-flow: auto;" class="loginField">
<table id="table" class="tbldesign" style="table-layout:fixed; margin-top : 0px;">
<thead>
<tr>
<th>
<a href="" title="Click Header to Sort">CLUBS FOR THIS TOURNAMNET</a>
</th>
</tr>
</thead>
<tbody>
<% foreach(var item in Model.ClubTour) {%>
<tr>
<td class="TdClick">
<%: item.ClubId %> <input type="hidden" class="ClubId" name="ClubId" value="<%: item.ClubId %>" />
</td>
</tr>
<%} %>
</tbody>
</table>
</div>
<div style="width: 460px;height: 300px; over-flow-x: auto; over-flow-y: auto; float:right;" class="loginField">
<table id="table2" class="tbldesign" style="table-layout:fixed; margin-top : 0px;">
<thead>
<tr>
<% foreach (var item in Model.Groups)
{%>
<th style="width:100px;" id="<%: item.GroupName %>">
<a href="" title="Click Header to Sort"> <%: item.GroupName %> </a>
</th>
<%} %>
</tr>
</thead>
<tbody>
<tr>
</tr>
</tbody>
</table>
</div>
</div>
我的代码jquery:
$('.TdClick').dblclick(function () {
var radio = $('.GroupName').length;
var data = $(this).find('[name = "ClubId"]').val();
if ($('input[name=GroupName]:checked').length <= 0) {
alert("Select Group Name");
}
else {
var valu = $('input[name=GroupName]:checked').val();
$('#table2 tbody').find('[id="'+ valu +'"]').append(data + "<input type='hidden' name='"+ valu +"' value='"+ data +"' />");
$(this).parent().remove();
}
});
Tdclick是表右侧表td类名(俱乐部名称) name = GroupName是隐藏值输入