jquery隐藏和确认窗口在Chrome中不工作
问题描述:
当我使用隐藏和确认在html中。仅在Chrome中隐藏功能无法正常工作。当显示确认窗口时,“aa”元素不会被隐藏。 IE和FF工作正常。
任何类型的建议表示赞赏。jquery隐藏和确认窗口在Chrome中不工作
<html>
<head>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js" ></script>
</head>
<body>
<a id='aa' href='javascript:hideit();'>try it</a>
<script type='text/javascript'>
function hideit() {
$('#aa').hide();
if (!confirm('hide?')) {
$('#aa').show();
return;
}
$('#aa').show();
}
</script>
</body>
</html>
答
请在所有浏览器检查下面的代码,它工作正常:
<html>
<head>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js" >
</script>
</head>
<body>
<a id='aa' href='javascript:hideit();'>try it</a>
<script type='text/javascript'>
function hideit() {
if (confirm('hide?')) {
$('#aa').hide();
}
else
{
$('#aa').show();
}
}
</script>
</body>
</html>
谢谢...
我想确认之前将其隐藏。谢谢您的回答。 –