Ajay Yadav 🎯 Profile picture
Apr 7 β€’ 18 tweets β€’ 5 min read
πŸ’› Day 3️⃣2️⃣ / 3️⃣0️⃣ days of basics in JavaScript series!

πŸ“Œ What are DOM selectors?

πŸ“Œ Types of DOM selectors?

πŸ“Œ Select by Id?

πŸ“Œ Select by query selector?

πŸ“Œ Select by class name?

πŸ“ŒSelect by tag name?

πŸ“ŒSelect by query selector all?

#javascript30

Let me explainπŸ§΅πŸ‘‡
πŸ“Œ What are DOM selectors?

➟ DOM selectors are used to select HTML elements or nodes or objects.

➟ Or, DOM selectors are used to selecting HTML elements within a document using JavaScript.
πŸ“Œ Types of DOM selectors?

➟ There are 2 types of DOM selectors.

1️⃣ Single element selector(Sigular selector)
2️⃣ Multiple elements selector(Plural selector)
1️⃣ Single element selector(Sigular selector)

➟ That means we can select only one node/element/object of the HTML within a document using a single element selector.

πŸ‘€ These are the single element selector

β—© getElementById
β—© querySelector
2️⃣ Multiple elements selector(Plural selector)

➟ That means we can select multiple nodes/objects/elements of the HTML within a document.
πŸ‘€ These are the multiples element selector

β—© getElementsByClassName
β—© getElementsByTagName
β—© querySelectorAll

πŸ’‘ Remember in this selector we have to write "Elements" not "Element"

Or,

β›” Element = Singular Selector
β›” Elements = Plural Selector
πŸ“Œ Select by Id?

➟ We can select an element with its unique ID using the getElementById selector.

➟ This selector returns "null" if there is no match.

πŸ‘€ Syantax:
- document.getElementById("ID")
➟ Here I have selected an HTML element that has a unique id that is "text"

➟ Now the color of that element will be changed to red.
πŸ“Œ Select by query selector?

➟ This is also a single element sector, which is used to select any HTML element it can be ID, Class, Element.

πŸ‘€ Syantax:
- document.querySelector(".class")
- document.querySelector("#Id")
- document.querySelector("tag")
➟ Or, it returns only the first element.

➟ Now the element with the class name "text" will be green.
πŸ“Œ Select by the class name?

➟ It returns the list of elements like an array.

➟ Or, it returns the HTML Collection.

➟ We can access those elements using an index similar to an array.

➟ And of course, we can add multiple classes separated by space.
➟ We can not apply a style to the array but if we want to apply then we have to select a specific element using the "index" or using loops.

➟ Now all items inside the HTML collection will be green.
πŸ“ŒSelect by tag name?

➟ This is also used to select the HTML elements using the tag names.

➟ It also returns the HTML Collection.

➟ Now the element that has 4 indexes will be red.
➟ We can not apply a style to the array but if we want to apply then we have to select a specific element using the "index" or using loops.

➟ Now all items inside the HTML collection will be red.
πŸ“ŒSelect by query selector all?

➟ This is also a multiple selector which is used to select multiple elements within a document.
➟ It returns the list of nodes/elements/objects similar to the array.

πŸ‘€ Syntax:

- document.querySelectorAll(".class");
- document.querySelectorAll("element");
➟ We can not apply a style to the array but if we want to apply then we have to select a specific element using the "index" or using loops.

➟ Now all items inside the HTML collection will be green.
πŸ’š That's all for now, we will meet in the next thread!

But if you like make sure to:

1. Follow me @ATechAjay

2. Retweet the first tweet.

3. Turn on the notification to never miss these amazing tweets.

Thank you so much for staying to the end of this thread.

β€’ β€’ β€’

Missing some Tweet in this thread? You can try to force a refresh
γ€€

Keep Current with Ajay Yadav 🎯

Ajay Yadav 🎯 Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @ATechAjay

Apr 8
⚑ 50+ JavaScript Projects Ideas ⚑ Image
✨ Do not worry we are going to build these all projects one by one in 2022.

✨ I will explain each and everything during building these projects.

✨ This is not listed in the serial wise or for beginner and advanced rather than we have to build these all projects.
πŸ“Œ Box shadow Controller

πŸ“Œ Image filter (blur, contrast, etc)

πŸ“Œ Border width slider

πŸ“Œ Background changer using HTML color picker

πŸ“Œ Border Radius Controller

πŸ“Œ Image position slider (X-axis and Y-axis)

πŸ“Œ Click to download something
Read 10 tweets
Apr 6
πŸŽ‰JavaScript Free PDF EbookπŸŽ‰

🎁 I have curated my javaScript series into a single PDF.

😍 Just you have to RT, Follow me( @ATechAjay ) & reply with "Hi Ajay πŸ‘‹" in this tweet, then I will come to your DM on the 10th of April.

DEMOπŸ‘€πŸ‘‡ Image
πŸ“Œ This PDF Ebook is a combination of my JavaScript series, where you can learn all basics of JavaScript in simple or easy explanation.

πŸ’š Now your start will be easy with JavaScript.
🎁 In this Ebook you will learn:

β–£ Values and Variable

β–£ Data type and its type

β–£ Variable declaration, initialization, assignment

β–£ Var, let, and const

β–£ Operator and Operand

β–£ Operator Precedence

β–£ Template literals

β–£ Type conversion

β–£ Type coercion
Read 6 tweets
Apr 5
⚑ 9 Ultimate Chrome Extension ⚑

πŸ§΅β†“
1️⃣ Twitter Print Styles

πŸ’‘ Convert your tweets into PDF

chrome.google.com/webstore/detai…
2️⃣ DarkPDF

πŸ’‘ Read PDF into Dark mode

chrome.google.com/webstore/detai…
Read 11 tweets
Apr 4
πŸ’› Day 3️⃣1️⃣ / 3️⃣0️⃣ days of basics in JavaScript series!

πŸ“Œ What is DOM?

πŸ“Œ What is DOM structure or tree?

πŸ“Œ What is DOM manipulation?

πŸ“Œ How to access or manipulate nodes using DOM?

πŸ“ŒJavaScript selectors?

#javascript30

Let me explain!πŸ§΅πŸ‘‡
πŸ“Œ What is DOM?

β–Ί DOM stands for Document Object Model.

β–Ί DOM is not part of JavaScript, it's an interface that allows programming language to change or remove the HTML elements.

β–Ί It is used to make the website interactive from the client-side.
β–Ί DOM is used to manipulate, style, or content of HTML elements.

β–Ί The "document" is the "root" element of the website.

β–Ί And the <HTML> is the child of the "document" node or object.
Read 10 tweets
Apr 2
πŸ›  20+ Free resources for the content creators!

A ThreadπŸ§΅πŸ‘‡
β—‰ Feem (offline)

πŸ’‘ For sharing your files between 2 devices.

feem.io
β—‰ File (online)

πŸ’‘ File-sharing websites!

file.io
Read 25 tweets
Mar 27
πŸ’› Day 2️⃣6️⃣ / 3️⃣0️⃣ days of basics in JavaScript series!

β†’ What is an array?

β†’ How many types of creating an array?

β†’ How to access array items & full array?

β†’ How to change the array items?

β†’ The data type of the array?

#javascript30

πŸ§΅β‡©
πŸ“Œ What is an array?

β†’ It is a special variable that can be store more than one value.

β†’ If you have multiple data items then you can use an array for storing those items.

β†’ It can hold many values in a single variable.
β†’ Or, storing a collection of multiple items in a single variable.

β†’ Js array can contain mixed types of data or items, like string, decimal, float, boolean, etc.
Read 11 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Don't want to be a Premium member but still want to support us?

Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal

Or Donate anonymously using crypto!

Ethereum

0xfe58350B80634f60Fa6Dc149a72b4DFbc17D341E copy

Bitcoin

3ATGMxNzCUFzxpMCHL5sWSt4DVtS8UqXpi copy

Thank you for your support!

Follow Us on Twitter!

:(