Viral Shah
Viral Shah

Reputation: 2246

Logic Behind the Use of jQuery?

I have good understanding how javascript as well as jQuery can be used in the HTML file but logically one question is arisen.

When we want to embed javascript into HTML file, generally (not every time) we write this simple code in head part.

<script type="text/javascript"> ... </script>

And when we want to embed jQuery at that time the same peace of code

<script type="text/javascript"> ... </script>

How can we identify by seeing this line only, is it js code or jQuery code?

Can anyone brief me about this logic?

Upvotes: 5

Views: 192

Answers (3)

Denys S&#233;guret
Denys S&#233;guret

Reputation: 382160

jQuery is just a Javascript script providing you, when you execute it before your own scripts, a few very useful functions.

When you're coding in jQuery, you're coding in Javascript.

This means of course that everything you do using jQuery could be done (sometimes with pain, especially if you're not experimented) in Vanilla Javascript.

Usually, you'll detect that a page is using the jQuery library by such an import in the head of the page :

<script type="text/javascript" src="jquery-ui-1.8.21.custom.min.js"></script>

but there is no guarantee as jQuery could be inlined in another script or loaded dynamically.

Upvotes: 9

Henrik M&#252;he
Henrik M&#252;he

Reputation: 429

There is no such thing as jquery code - jquery is a library build on top of javascript. So you can have pure javascript code or javascript code that uses jquery. Seeing if jQuery is actually used requires looking at the sourcecode, not just the containing tags.

Upvotes: 1

Curtis
Curtis

Reputation: 103368

jQuery is javascript

jQuery is simply a javascript library allowing you to carry out actions which require less code (because the jQuery code does the extra javascript work for you).

jQuery is a multi-browser JavaScript library designed to simplify the client-side scripting of HTML

Source: Wikipedia

Upvotes: 1

Related Questions