我下面有一个函数,仅在选中同一tr中的复选框时才触发。请告诉我我在做什么错,通常的方法不起作用。谢谢
JS
$(".add_menu_item_table").live('click', function() {
var value_td = $(this).parents('tr').find('td.td_name').text();
if ($('input.checkbox_check').attr(':checked')); {
var newDiv = $('<div class="div_menu_button"></div>');
var showDiv = $('<div id="show' + "0" + numShow++ + '" class="menu_button_info hidden"></div>');
var toggleTrigger = $('<a id="toggleshow' + "0" + numToggle++ + '" data-target="#show' + "0" + numTarget++ + '" class="toggle_trigger actions"> </a><div style="padding:5px"></div>');
var menuForm = $('<form id="menu_edit_form' + "0" + numForm++ + '" class="menu_creation_form"></form>');
$('#created_buttons_list').append(
newDiv.text(value_td)
);
newDiv.wrap("<li></li>");
newDiv.append(toggleTrigger);
newDiv.append(showDiv);
showDiv.append(menuForm);
}
});
var numToggle = 0;
var numShow = 0;
var numTarget = 0;
var numForm = 0;
var numLabelone = 0;
var numLabeltwo = 0;
var numLabelthree = 0;
<table width="316px" border="0" cellspacing="0" cellpadding="0" id="table-data">
<tbody>
<tr>
<td width="20px"><input type="checkbox" style="width:20px;" value="1" name="checkbox"></td>
<td width="200px"><a href="/admin/feedbackmanager/sortby/2/sortdesc/0">Page Name</a></td>
<td width="20px"><a href="/admin/feedbackmanager/sortby/3/sortdesc/0">Add</a></td>
</tr>
<tr>
<td><input type="checkbox" style="width:20px;" value="1" name="checkbox" class="checkbox_check"></td>
<td class="td_name">Timeplot</td>
<td><input class="add_menu_item_table" name="add_menu_item" value="Add" type="button"></td>
</tr>
<tr>
<td><input type="checkbox" style="width:20px;" value="1" name="checkbox" class="checkbox_check"></td>
<td class="td_name">Operations Manuals</td>
<td><input class="add_menu_item_table" name="add_menu_item" value="Add" type="button"></td>
</tr>
</tbody>
</table>
www说
相关分类