我有一个充当“淡入淡出”页面过渡的js:
jQuery('body').css('display','none');
jQuery(document).ready(function() {
jQuery('body').fadeIn();
jQuery('a').on('click',function(event){
var thetarget = this.getAttribute('target')
if (thetarget !="_blank" ) {
var thehref = this.getAttribute('href')
event.preventDefault();
console.log(thehref)
if(thehref){
console.log('not null')
jQuery('body').fadeOut(function(){
window.location = thehref
});
}
}
});
});
setTimeout(function(){
jQuery('body').fadeIn();
},1000)
我有这个表格:
<form id = "create_faculty_formcontainer" action = "" method = "post">
<input type = "text" name = "fac_idnumber" placeholder="ID Number" required/><br/><br/>
<input type = "text" name = "fac_firstname" placeholder="First Name" required/><br/><br/>
<input type = "text" name = "fac_lastname" placeholder="Last Name" required/><br/><br/>
<input type = "password" id = "password_fac" name = "fac_password" placeholder="Password" required/>
<br/>
<input type = "submit" name = "fac_submit" value = " sign up ">
</form>
每当我单击“提交”按钮时,都不会发生任何事情。因此,我尝试删除JavaScript,并且该按钮正常工作。 js一定是导致Submit按钮无法正常工作,我实际上无法弄清楚它是什么或如何解决。
关于如何保持javascript并使“提交”按钮也起作用的任何想法?
最佳答案
我知道了。
擦除event.preventDefault();
会使它稳定。
感谢Korgrue