How does Jquery work with WordPress?

Keep in mind right now I am familiar with JS but not JS libraries, so right now I am going through a tutorial and the instructor has this line of code in his functions.php:

p\_enqueue\_script(‘main-university-js’, get\_theme\_file\_uri(‘/build/index.js’), array(‘jquery’), ‘1.0’, true);

Ok fine, you are basically linking your JS code with this line and I am assuming it also links this code to a Jquery library. But I go to check the code out in index.js and after expanding it it is over 1K lines of code. What is the point of linking to Jquery if you have to type 1K lines of code yourself? Isn’t a library supposed to prevent this sort of thing? And if you are copying and pasting to Jquery, why link to the framework at all?

1 Comment
  1. jQuery is mostly just an abstractin layer to Javascript itself, makes some code a bit easier to write as pure Javascript can be a bit asinine/non-intuitive if you’re just delving into coding. It doesn’t make website functionality, it’s just a framework to build it upon.

    It’s not copy and pasting anything either, it’s just stating a requirement/dependency of the code.

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer