当我尝试在internet explorer 7/8上集中一些输入和选择框时,我得到了同样的老错误。
jQuery代码如下:
$("#planner input, #planner select").on("focus",function() {
panel = $(this).parents(".panel").first();
if (!panel.hasClass("active")) {
tab = panel.data("tab");
$("#planner .tabs li[data-tab="+tab+"] a").trigger("click");
}
}); 有人能帮我吗?
编辑:
我在这里粘贴了整个代码
<script>
$(document).ready(function(){
$("#planner .tabs a").click(function() {
$(this).parents("#planner").find(".panel.active").removeClass("active");
$(this).parents("#planner").find(".tabs li.active").removeClass("active");
$(this).parent().addClass("active");
tab = $(this).parents("#planner").find(".tabs li").index($(this).parent());
panel = $(this).parents("#planner").find(".panel");
$(panel[tab]).addClass("active");
});
$("#planner #quote").validate({
ignore: "",
errorPlacement: function(error, element) {
error.appendTo(element.closest(".item"));
}
});
$("#planner input, #planner select").on("focus" , function() {
panel = $(this).parents(".panel").first();
if (!panel.hasClass("active")) {
tab = panel.data("tab");
$("#planner .tabs li[data-tab="+tab+"] a").trigger("click");
}
});
});
</script>发布于 2013-10-24 18:31:02
用"active“替换"focus”行吗?
更新:
以下是我在ie8中的工作,必须是你的事件中的一个问题
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<title></title>
<script language="javascript">
$(document).ready(function () {
$("#planner input, #planner select").on("focus", function () {
alert('focus');
});
});
</script>
</head>
<body>
<div id="planner">
<input type="text"/>
</div>
</body>
</html>发布于 2013-10-24 18:56:10
问题出在您的jQuery文件版本。使用jQuery最新版本的文件。
https://stackoverflow.com/questions/19563407
复制相似问题