jQuery的:
$(".close_invoice").confirm({
title: 'Are you sure to delete it?',
content: 'Click to Delete if you are sure else click on Close.',
type: 'red',
typeAnimated: true,
buttons: {
delete: {
text: 'Delete',
btnClass: 'btn-red',
action: function() {
alert($(this).attr("id"));
}
},
close: {
text: 'Close',
btnClass: 'btn-blue',
action: function() {}
}
}
});
HTML:
<button class="btn btn-sm green btn-outline filter-submit margin-bottom close_invoice" id="14" jc-attached="true"><i class="fa fa-times"></i> Close Invoice</button>
任何人都可以告诉我为什么不采用属性ID的值。如何获取属性ID的值?它警告未定义。
答案 0 :(得分:1)
您无法在this
中使用function object parameters
选择器..您可以将此value
保存到变量中,然后将其设为function paramater object's value