作者:谷智精源 | 来源:互联网 | 2023-05-18 11:56
Thisisakindofsimilarduplicatetosomeothershere,butIthinkImusingevent.preventDefault(
This is a kind of similar duplicate to some others here, but I think I'm using event.preventDefault() correctly in this case.
这是一种与其他一些类似的重复,但我认为我在这种情况下正确使用了event.preventDefault()。
this my html :
这是我的HTML:
in Chrome, it is work. but in Firefox, it does not work.
在Chrome中,它是有效的。但在Firefox中,它不起作用。
this my code :
我的代码:
function check_empty_2() {
if (document.getElementById('reg_nama').value == "" || document.getElementById('reg_email').value == "" || document.getElementById('reg_no').value == "" || document.getElementById('reg_rumah').value == "" ) {
alert("Harap isi semua bidang !");
} else {
document.getElementById('reg_rfid').style.display = "none";
document.getElementById('alert_rfid').style.display = "block";
$('html, body').animate({
scrollTop: $("#alert").offset().top - 150
});
event.preventDefault();
}
}
please correct my code, Thank you
请更正我的代码,谢谢
4 个解决方案