【发布时间】:2009-11-29 15:51:57
【问题描述】:
我有以下使用 jquery 的删除确认代码。问题是它假定名称列的位置。我现在在第一行有名字。除了使用.prev('td'),还有没有使用jQuery从当前行的第一列获取值?
<script type='text/javascript'>
$(document).ready(function() {
$("a.delete").click(function(e) {
e.preventDefault();
var url = $(this).attr("href");
var name = $(this).parent().prev('td').prev('td').text();
jConfirm('Are you sure you want to delete this:' + name, 'Application Delete', function(r) {
if (r) {
window.location = url;
}
});
});
});
</script>
【问题讨论】:
标签: jquery html html-table