DOM Manipulation
Installation
DOM manipulation with jQuery
// This is the basic syntax for jQuery selections
$(' ')
// To select a particular element by tag, you do
$('div') // selects all div elements
// To select by ID, you use the same syntax as CSS selectors
$('#someID') // Would select the element with ID="someID"
// To select all elements of a particular class, use CSS syntax again
$('.someClass') // Selects all elements of the class "someClass"
// And you can use more complicated CSS selectors as well
$('p.anotherClass') // Selects all <p> tags that also have the class "anotherClass" (<p class="anotherClass">)Selecting a DOM element and changing it's content
Adding and removing DOM elements
Last updated