我有一个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必须导致提交按钮不起作用,我实际上无法弄清楚它是什么或如何解决它。 关于如何保留javascript并使提交按钮也能正常工作的任何想法?
答案 0 :(得分:1)
我已经弄明白了。
删除event.preventDefault();
解决它。
感谢Korgrue