我确定这个问题已经被问过了,但我找不到合适的关键字来喂谷歌。我什至找不到我的问题的好标题。我想做这个 :
$(".selector").click(function() {
$(this).css("background-color", "red");
if (confirm("Do you want to do this ?") {
// do this
} else {
$(this).css("background-color", "transparent");
}
});
但是只有在我确认后才会触发 css 更改。如何在确认之前(或在确认期间)触发它?
谢谢。