Error "Uncaught ReferenceError: $ Is Not Defined"
I began to study the 'javascript'. in html source code
Solution 2:
$
is an alias for the jQuery library. In this case, you don't need jQuery at all. You can just execute that IIFE (immediately-invoked function expression) and it should work fine.
"use strict";
(function() {
document.getElementById("test_button").onclick = test_click;
function test_click() {
document.getElementById("test").innerHTML = "HI";
}
})();
<!Doctype html>
<html>
<head>
<meta charset="utf-8">
</head>
<body>
<button id="test_button">Test</button>
<p id="test">Hello World</p>
<!-- script -->
<script src="test.js"></script>
</body>
</html>
Post a Comment for "Error "Uncaught ReferenceError: $ Is Not Defined""