我想我可能会使用错误的js库。不知道..我在网上学习一个教程,我看到这个人编码,并看着它的工作。我审查了两次,并完成了,仍然没有工作。简单的jQuery切换(不工作)
这里是我的html:
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Title</title>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script src="hideshow.js"></script>
</head>
<body>
<a href="#" id="hideshow">Hide </a>
<div id="message" style="width:300px; border:1px solid black; padding:10px">
This is the wording inside of the text for testing purposes.
</div>
</body>
这里是我的JS从hideshow.js:
$('#hideshow').toggle(function() {
$('#hideshow').text('Show');
}, function() {
$('#hideshow').text('Hide');
});
我很感激,感谢谁可以算出来。 :(
拨动事件从jQuery的1.9取出后。看到http://api.jquery.com/toggle-event/ – j08691