Javascript <;a href不';点击IE中的jquery函数调用,可以在Chrome和FF上正常工作

Javascript <;a href不';点击IE中的jquery函数调用,可以在Chrome和FF上正常工作,javascript,jquery,Javascript,Jquery,我的代码: Jquery部分: $('#yesdownloadvideo').click(function(){ var expiryTime = parseInt($('#expirytime').val()); $('#fade, #popuprel').fadeOut() setCookie("emailpopup","cookie already set",expiryTime); }); Html部分: <div class="yes-btn"><a

我的代码:

Jquery部分:

$('#yesdownloadvideo').click(function(){
var expiryTime = parseInt($('#expirytime').val());    
$('#fade, #popuprel').fadeOut()
setCookie("emailpopup","cookie already set",expiryTime);    
});
Html部分:

<div class="yes-btn"><a id="yesdownloadvideo" href="<%=yesbuttonlink%>.html" target="_blank" style="text-decoration:none"><input type="submit" class="yesbtn-src" value="<%=yesText%>" /></a></div>

使用
preventDefault()
类似

$('#yesdownloadvideo').click(function(e){
   e.preventDefault();
   var expiryTime = parseInt($('#expirytime').val());    
   $('#fade, #popuprel').fadeOut()
   setCookie("emailpopup","cookie already set",expiryTime);    
});
还可以更改您的html格式

// Remove your submit button from link
<div class="yes-btn">
     <a id="yesdownloadvideo" href="<%=yesbuttonlink%>.html" target="_blank" 
         style="text-decoration:none"><%=yesText%></a>
</div>

您的HTML无效。在
a
中不能有
输入。浏览器从该错误中恢复是不稳定的。看起来输入正在捕获IE中的点击


你可以有一个链接一个提交按钮,但不能两者都有。

为什么要将提交按钮包装在锚标记中?这可能是由于触发锚内包含的提交按钮单击,并且缺少
preventDefault()
方法。你需要一个更好的机制来处理这两种情况。你是说默认锚导航没有发生,但你希望它发生?或者他们希望在表单提交后重定向?是的,我希望默认锚导航发生,发布。单击函数调用
<div class="yes-btn">
     <a id="yesdownloadvideo" href="<%=yesbuttonlink%>.html" target="_blank" 
         style="text-decoration:none"><%=yesText%></a>
     <input type="submit" class="yesbtn-src" value="<%=yesText%>" />
</div>