1
这是不必求人真的基本很抱歉提前:○jQuery的新手 - 为什么不能正常工作?
我设置一个简单的页面使用jQuery玩,但我不能让一个简单的显示/隐藏功能工作。
这里是我的代码..
<html>
<head>
<title>Testing Javascript/jQuery</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
<script>
$(document).ready(function() {
$("div p").hide();
});
$("show").click(function(){
$("div p").show()
});
$("hide").click(function(){
$("div p").hide()
});
</script>
</head>
<body>
<button id='hide'>Click to hide the text</button>
<button id='show'>Click to show the text</button>
<div><p>you can't see me!</p></div>
</body>
</html>
铬合金的开发工具不提供任何错误,以便即时通讯不知道去哪里找。
文本最初隐藏起来,但显示和隐藏按钮什么也不做。
使用#作为id和。到类选择器。并提示:如果您使用jQuery CDN(从外部jQuery脚本调用,请执行以下操作:)在生产中,您可能会受到页面加载速度下降的影响 – 2013-02-10 15:51:16
@EricMartins你是什么意思?对于缓存,使用CDN脚本通常比使用自己的脚本更快,更温和。 – 2013-02-10 16:02:53
@dystroy我经常遇到错误,因为这些脚本的主机响应时间太长,但是大多数情况下速度更快。 – 2013-02-10 16:19:13