0
我有要求在jQuery中显示动态表。在点击表格数据时,值应该在下面的文本字段中设置。jquery ui动态表onclick事件不起作用
我可以知道如何从动态表捕捉名称并设置成文本字段
$(document).ready(function() {
//Retrieve the JSON data from the server using AJAX
$('#AJAXButton').click(function() {
$.getJSON('ajax/ajaxtest.js', function(data) {
processJSON(data);
});
});
//Process and display the JSON data
function processJSON(data) {
var output = '<table><tr><th>Name</th><th>Platform</th></tr>';
//Loop through the Languages
$(data.Languages).each(function(index, element) {
output += '<tr><td class="clickable">' + element.Name + '</td>' +
'<td class="clickable">' + element.Platform + '</td></tr>';
});
output += '</table>';
$('#AJAXDiv').html(output);
}
$("tr.clickable").live("click", function() {
$("#name").append(?);
});
});
<div id="AJAXDiv" style="width:400px; height:600px; background-color:#ddd; border:1px solid black">
</div>
<div>
<label for="name">Created by: </label> <input id="name" />
</div>
这对我来说非常适合。感谢您指出我的错误 – dan
没问题!如果这是你以后的事情,请标记为答案! =) –