我想在使用类“找到”div中的按钮后使用alertify.js .removeRow
$(".removeRow").find("button").click(function(){
alertify.confirm("remove this field?", function (e) {
if (e) {
// user clicked "ok"
$(this).closest(".agrRow").remove();
}
});
});
问题是在我调用alertify之后,我放松了“this”的值。 如何将“this”传递给alertify函数?
答案 0 :(得分:4)
$(".removeRow").find("button").click(function(){
var temp = this;
alertify.confirm("remove this field?", function (e) {
if (e) {
// user clicked "ok"
$(temp).closest(".agrRow").remove();
}
});
});