这个jQuery有什么问题(参见JS Fiddle:fiddle)。点击事件不会触发。它必须是简单的东西,但我看不到它:
var form;
var submitting;
var submitBtn;
$(document).ready(function () {
form = $("#form");
submitting = $("#submitting");
submitBtn = $("#submitBtn");
// set the submitting div height to that of the form
$(submitting).css("height", $(form).height());
$(submitting).css("opacity", 0);
//alert(submitBtn);
// transition in when the button is clicked
$(submitBtn).click(function (e) {
e.preventDefault();
alert("why don't I fire!");
$(form).animate({
opacity: 0
}, 400);
});
});
答案 0 :(得分:2)
实际上用户无法点击按钮,因为div submitting
与表单重叠。将div的位置更改为relative,然后它将正常工作
#submitting {
display:table;
position:relative;
top:0
}
答案 1 :(得分:1)