why we use $ in jquery 1

why we use $ in jquery

$ is the shortcut for jQuery and acts as a selector. Similar to querySelector
$('#id')
$('.class')
$(this)

Here is what the above code is Doing:
1. When the page loads, the browser will run the code inside the $(document).ready() function.
2. The browser will then create a new

element and store it in a variable called box.
3. The browser will then add the text “Hello World” inside the

element.
4. The browser will then add the

element to the end of the element.

Similar Posts