您好我有一张将动态填充的表格。它有一个选择框,在选择时应该打开pop但我不知道所选行的ID。我如何知道从中选择它的选择项目。
<table>
<tr id="<%=columnId%>" >
<td class="lic-3-4"><%=columnName%></td>
<td id="datatype" class="lic-3-4"><%=dataType%></td>
<td class="lic-5-4"><div ><select class="mol-select-tc" name="action_col1" id=""<%=columnId%>"></select></div></td>
</tr>
<tr id="<%=columnId%>" >
<td class="lic-3-4"><%=columnName%></td>
<td id="datatype" class="lic-3-4"><%=dataType%></td>
<td class="lic-5-4"><div ><select class="mol-select-tc" name="action_col1" id=""<%=columnId%>"></select></div></td>
</tr>
<tr id="<%=columnId%>" >
<td class="lic-3-4"><%=columnName%></td>
<td id="datatype" class="lic-3-4"><%=dataType%></td>
<td class="lic-5-4"><div ><select class="mol-select-tc" name="action_col1" id=""<%=columnId%>"></select></div></td>
</tr>
</table>
var selectedAlgSelect = $('#action_col1');//here I want the select the dynamically //generated id of select column
selectedAlgSelect.die('change').live('change',function(){
var rowEl = $(this).closest('tr');
var currentRow = $(rowEl);
var dataType = currentRow.find('td[id=datatype]').text();
var selectEl = currentRow.find('select[name=action_col1]').val();
}
答案 0 :(得分:1)
这是有效的
var selectedAlgSelect = $('select');
selectedAlgSelect.die('change').live('change',function(){
......
}