我使用jquery动态填充表。 我想通过单击表格的单元格来生成点击事件。 我想在单击单元格后检索单元格的值 但是,没有为已由数据动态填充的表生成click事件 同时我有另一个表,其中包含生成click事件的静态数据 请帮我解决问题
遵循这段代码
<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
<title>Package Data Retrieval</title>
<style>
.boldtable,.boldtable TD,.boldtable TH {
}
.labelclass
{
}
.buttonclass{
}
</style>
</head>
<body bgcolor="#3d4352">
<div id="div1"
style="background-color: #76848f; height: 245px; overflow: auto;"
align="center">
<table border="1" class="boldtable" id="table1">
<caption>
<b>Modality List</b>
</caption>
<tr>
<th>Modality Name</th>
<th>Modality Version</th>
<th>Package Name</th>
<th>Package Version</th>
<th>Updated On</th>
<th>Updated By</th>
</tr>
</table>
<br>
</div>
<div align="center" style="background-color: #76848f">
<label class="labelclass">Model Name</label>
<label class="labelclass">Package Name</label>
<label class="labelclass">Package Version</label>
<br> <input type="text" id="searchmodel" size="28"> <input type="text" id="searchpackagename" size="28">
<input type="text" id="searchpackageversion" size="28"> <input type="button"
value="Search" width="100" id="search" class="buttonclass"> <br> <br>
</div>
<br>
<br>
<div id="div2"
style="background-color: #76848f; height: 245px; overflow: auto;"
align="center">
<table border="1" class="boldtable" id="installerlisttable">
<caption>
<b>Installer List on Selected Modality</b>
</caption>
<tr>
<th>Installer Name</th>
<th>Installer Version</th>
<th>Installation Status</th>
<th>Installer Sent Status</th>
</tr>
<tr>
<td>Inst1</td>
<td>1</td>
<td>Done</td>
<td>Sent</td>
</tr>
<tr>
<td>Inst2</td>
<td>1</td>
<td>Done</td>
<td>Sent</td>
</tr>
</table>
<br>
</div>
<br>
<div align="center">
<input type="text" size="40"> <input type="button"
value="Browse" class="buttonclass"><input
type="button" value="Remote Connect" class="buttonclass">
</div>
<script src="jquery.min.js"></script>
<script src="jquery-ui.min.js"></script>
<script>
$(document).ready(function() {
$("tbody td").click(function(e) {
var currentCellText = $(this).text();
alert(currentCellText)
});
$('#table1').append('<tr><td> abc</td></tr>');
});
</script>
</body>
</html>