我想我可能會使用錯誤的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