我想在 div 中“找到”带有 .removeRow 类的按钮后使用alertify.js
$(".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函数中?
最佳答案
$(".removeRow").find("button").click(function(){
var temp = this;
alertify.confirm("remove this field?", function (e) {
if (e) {
// user clicked "ok"
$(temp).closest(".agrRow").remove();
}
});
});
关于javascript - 通过 'this' 进行警报,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26494382/