Hi I am having a \"Uncaught ReferenceError: $ is not defined\" while using bellow codes
I am currently getting the following error in my log. I have been looking at the
$
is a function provided by the jQuery library, it won't be available unless you have loaded the jQuery library.
You need to add jQuery
(typically with a element which can point at a local copy of the library or one hosted on a CDN). Make sure you are using a current and supported version: Many answers on this question recommend using 1.x or 2.x versions of jQuery which are no longer supported and have known security issues.
Make sure you load jQuery before you run any script which depends on it.
The jQuery homepage will have a link to download the current version of the library (at the time of writing it is 3.5.1 but that may change by the time you read this).
Further down the page you will find a section on using jQuery with a CDN which links to a number of places that will host the library for you.
(NB: Some other libraries provide a $
function, and browsers have native $
variables which are only available in the Developer Tools Console, but this question isn't about those).