我一直在試圖讓一個簡單的jQuery示例現在工作幾個小時。jQuery拒絕工作
<!DOCTYPE html>
<html>
<head>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js">
</script>
<script>
$(document).ready(function(){
$("button").click(function(){
$("p").toggle();
});
});
</script>
</head>
<body>
<button>Toggle</button>
<p>This is a paragraph with little content.</p>
<p>This is another small paragraph.</p>
</body>
</html>
我似乎無法加載jQuery。
最佳猜想:您沒有在您的計算機上安裝Web服務器,並且您正在從本地文件系統加載頁面,所以jQuery地址中的// //會選擇file://協議。這將是學習瀏覽器錯誤控制檯如何工作的好時機,因此您可以自己調試這樣的事情。 – JJJ
您可以在ajax.googleapis.com前刪除//然後嘗試 – Satya
@Satya這肯定無效。 – JJJ