

How to use JQuery? What is it? Written By Nima Owji
source link: https://dev.to/nima_owji/how-to-use-jquery-what-is-it-written-by-nima-owji-3ah6
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Intro
Hello, My name is Nima Owji. I am a 14 years old programmer. Today, I want to talk about JQuery! What is JQury? jQuery is a JavaScript library. You can use it on your websites.
How to add JQuery to our project?
You can download JQuery from https://jquery.com/download/ or you can use a CDN (Content Delivery Network). There are many CDNs for JQuery.
After that, you should reference it to your HTML page (Like CSS but a bit different)!
As you know you can write your codes in "script" tags. You can also use the src attribute of script tags for referencing a js file!
See this example:
<script src="jquery-3.5.1.min.js"></script>
You should assign your JQuery path to the src attribute. For Example, my JQuery is in root and I can simply write the name of the file.
How to use JQuery?
You should write your scripts after referencing JQuery because if you write your codes before it, they won't work.
You can simply write your codes in another .js file or in script tags.
Like this:
<script src="jquery-3.5.1.min.js"></script>
...
<script>
//Your JQuery Codes
</script>
How to write JQuery codes?
JQuery codes are too easy, first of all, you should call JQuery. For this, you should use a "$" at the beginning of your codes.
After "$", you should select one or many elements, for this, you can use CSS query selectors.
Like this
<script>
$("#MyElementID")...
$(".MyClass")...
$("MyElementTagName")...
</script>
after that, you can modify your elements with JQuery methods, They are so many and I can't tell you all of them but you can search for them in documentations.
For example, this code will hide an element with "el1" id!
<script>
$("#el1").hide();
</script>
JQuery Codes
jquery codes are like this:
$(css_selector).[jquery_method];
Follow me on Twitter and don't forget to like it!
I hope you liked this article. If you liked this, Please follow me on Twitter https://twitter.com/nima_owji. And like this article. Thanks a looooooooooooot. Have a nice time!
Recommend
-
109
(转自公众号:前端八点半,已授权) 前言 在MV*框架兴起,前端告别刀耕火种进入工程化的今天,还没来得及学习Angular,Facebook就带着react框架降临,不久vue.js又在这些框架打得火热的时候脱颖而出,各种框架充斥着我们的视觉神经,好像操
-
132
前言 对于AngularJS什么,小编在这就不多做介绍了。大家可以看小编的上一篇博客。 言归正传,小编在上一篇博客中介绍了AngularJS中的指令、表达式还有非常实用的三种服务...
-
177
你是一名JavaScript新手?或是您曾经向自己的Web页面上添加过一些脚本,但想以一种更好的方式来实现它们?本书非常适合您。本书不仅向您展示如何阅读和编写JavaScript代码,同时还会以一种简单且视觉化的方式,教您有关计算机..
-
10
How and Why to Use Modern jQuery in WordPress Posted on 21st July 2020Updated on 8th September 2020WordPress
-
7
One-click attack nima? XSRF/CSRF (one-click attack) hujumlar deb bir zararli saytdan turib boshqa saytga hujum qilinishga aytiladi. Quyidagi holatga...
-
19
Helidon Nima - Loom based microservices framework For quite a long time we...
-
8
Say No to Python/DjangoSay No to Python/Django - Use PHP/JQuery InsteadMarch 2nd 2023 New Story3 min by
-
6
Suspect Nima Momeni held over Cash App founder's deathPublished4 days ago
-
3
Who is Nima Momeni, accused of fatally stabbing Cash App founder Bob Lee?AdvertisementClose
-
8
Home ...
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK