Video summary
Part 2 – Master JavaScript & Become a Real Developer | Full Course
Main summary
Key takeaways
Summary of the subtitles (Part 2: DOM + core JS to become a real developer)
Video/Series context
- Host: Harsh Vandana Sharma (Sherians Coding School)
- Part: 2 of 4 in a JavaScript-to-developer course
- Positioned as a “full course” with projects and ongoing updates (Instagram mentioned)
What the video covers (major technical topics)
1) DOM fundamentals + DOM manipulation goal
- DOM = Document Object Model
- The browser converts the HTML into a tree of nodes (elements, text, comment nodes).
- Core idea:
- DOM is not the topic; DOM manipulation is
- Using JavaScript to change what’s displayed on the page.
- Examples of UI changes conceptually demonstrated:
- show/hide banners
- buttons triggering downloads
- spinners/animations and moving UI layers
- hover/scroll-based effects
2) Selecting elements (core DOM APIs)
- Single element selection
document.querySelector(...)(selects the first match)
- Multiple element selection
document.querySelectorAll(...)(returns a node list)
- Legacy-style alternatives mentioned:
getElementByIdgetElementsByClassName
- Emphasis:
querySelectoruses CSS selector syntax (#id,.class,tag)querySelectorreturns only the first matchquerySelectorAllreturns all matches
3) DOM manipulation: changing text/content
- Focus on updating element content using properties:
innerHTML- inserts HTML (tags get interpreted)
innerText/textContent- sets text (tags are treated as text)
- Debugging approach repeated:
- uses
console.dir/console.logto inspect properties on the selected node
- uses
- Practical recommendation:
- Prefer
textContent(faster; includes hidden text) innerTextis slower and reflects only visible text
- Prefer
4) Attribute manipulation (get/set/remove)
- Three attribute operations:
getAttribute(name)(read)setAttribute(name, value)(update)removeAttribute(name)(delete)
- Examples:
- Change an
<a>tag’shrefto alter navigation destination - Change an
<img>tag’ssrcto swap images - Remove
hrefso the element no longer behaves like a link
- Change an
5) Dynamic DOM manipulation (create/append/prepend/remove)
- Core methods:
document.createElement(tagName)(create new elements)appendChild(child)(add at the end)prepend(child)(add at the beginning)removeChild(child)(delete nodes)
- Built examples (project-like tasks):
- create and insert new
<li>items into a<ul> - create and insert a new image into a
<div>and apply size via classes - delete the first
<li>in a list
- create and insert new
6) Style manipulation vs class-based styling
- Two approaches:
- Direct inline styling
element.style.property = value- (e.g.,
backgroundColor)
- Class-based styling
classList.add(...)classList.remove(...)classList.toggle(...)
- Direct inline styling
- Strong recommendation:
- Use class-based styling for maintainability and cleaner CSS application
Practice + concept questions (“Confusion/QA”)
- Covers/asks common theory:
- What is DOM?
- DOM node types:
- element node
- text node
- comment node
- Difference between:
- element node vs text node
getElementByIdvsquerySelectorinnerTextvstextContentvsinnerHTML
- Practice tasks include:
- changing header text by ID
- looping through list items (e.g.,
forEach/for) and printing text - replacing paragraph content that contains HTML tags using
innerHTML - getting image
src(via direct property or attribute) - setting image
src(viasetAttribute) - updating a link’s
href
Event handling (major next section)
1) Events vs event listeners
- Event: what the user does (click, double-click, mouse move, typing, etc.)
- Event listener: the handler attached to run when the event occurs
2) Add/remove event listeners
- Add:
element.addEventListener(eventName, function)
- Remove:
element.removeEventListener(eventName, sameFunctionReference)
- Demonstrated logic:
- click changes an element color
- double-click changes it again
- removal requires the same function reference
3) Common events covered
- Demonstrations include:
clickinputchangesubmitmouseover,mouseoutmousemove
- Also mentions keyboard-like events:
keydown/keyup
4) Input event with conditional logic
- “As-you-type” behavior using
inputevent:- prints typed value
- handles backspace (value becomes empty/changes)
- conditional logic for empty values (avoid printing nothing or use a default/spacing behavior)
Larger interactive examples inside the course
A) “Select device” dropdown using change event
- Builds a
<select>with options that includevalue - On change:
- reads
event.target.value - updates an
<h3>(e.g., “Device selected”) - formatting via CSS (
text-transform: capitalize)
- reads
- Key emphasis:
- options must have
valuefor meaningfulevent.target.value
- options must have
B) Keyboard typing visualizer (window keydown + H1 update)
- Uses
window.addEventListener('keydown', ...) - Reads
event.keyto update text in an element (e.g.,<h1>) - Special case for space:
- handles
" "by inserting" "or a placeholder like"SPC" - adjusts styling via CSS letter-spacing when needed
- handles
C) Custom file upload UI using dynamic DOM + input[type=file]
- Hides the native file input:
display: none
- Creates a custom UI button that triggers the hidden input
- On file input
change:- reads the filename via
event.target.files[0].name - updates UI text to show selected filename
- handles cancel case (files becomes empty/undefined) by checking existence (no optional chaining mentioned)
- reads the filename via
D) Form handling with submit + preventDefault
- Explains why form submit often reloads the page (wiping DOM changes)
- Fix:
event.preventDefault()
- Then:
- uses form input values to dynamically create a “card”
- creates elements like
div,img,h3,h5,p - fills them from the form inputs
- appends the new card into a container div
- creates elements like
- uses form input values to dynamically create a “card”
- After submit:
- clears non-submit inputs by setting
.value = ""
- clears non-submit inputs by setting
Main speakers / sources (from the subtitles)
- Harsh Vandana Sharma (host / instructor)
- Sherians Coding School (channel/source branding)