0

嗨,我有一个将动态填充的表。它有一个选择框,在选择时应该打开 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();
    }
4

1 回答 1

1

This is working

var selectedAlgSelect =  $('select');
     selectedAlgSelect.die('change').live('change',function(){  
......
}
于 2013-09-19T11:50:48.100 回答