Module 6 - Lesson 3
Methods for Selecting Elements
Lesson Overview
In this lesson, we’ll look into various methods of selecting elements, using the standard CSS selectors and also jQuery functions that allow you to traverse HTML documents to target any element you can think of.
Video Chapters
Sample selectors and traversal methods:
$('element, element, element') // select multiple elements
$('#id') // select the CSS ID
$('.class') // select the CSS class
$('parent > child') // select direct children
$('ancestor descendant') // select all descendants
$(':header') // select all headings
$(':contains("text")') // select elements which contain text
$('parent').find('selector') // gets all selected children of the parent selector
$('parent').children() // gets selected children a single level down the DOM tree
$('child').parents() // gets all the parent elements
$('child').parent() // gets the parent a single level up the DOM tree
$('element').siblings() // gets the sibling elements
$('element').prev() // gets the immediately preceding sibling
$('element').next() // gets the immediately following sibling
Login to your Account
If you're a DSA Student, please log in to your account to access the course content.
Sorry, you don't have access to this content.
It looks like you're not enrolled in Divi Stylist Academy.
