我想在使用类.removeRow的div中“查找”按钮后使用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/