Affecting Elements
.text()
Sets new text on an element
$(".hero-heading").text("Hello");Gets the current text of an element
let heroHeadingText = $(".hero-heading").text();.addClass()
$(".card").addClass("is-active");.removeClass()
.toggleClass()
.hasClass()
.val()
Gets the value of a form field
Sets a value on a form field
Clears the value of a form field
.remove()
.appendTo()
Moves cta-card into the cms-list as the last child
Moves cta-card into the cms-list as the last child using variable
Makes a copy of cta-card and adds the copy as the last child of cms-list
Creates a new div with class of "cta-card" and adds it as the last child of "cms-list"
.prependTo()
Moves cta-card into the cms-list as the first child
.insertBefore()
.insertAfter()
.css()
Gets the background color of the hero
Sets the background color of the hero
Gets the value of the --swatch--brand css variable on the html element
Sets the value of the --swatch--brand css variable on the html element
.attr()
Gets the href (url) on a link
Sets the href (url) on a link
Gets the source (url) of an image
Sets the source (url) of an image
Get the arial-label of an element
Set the arial-label of an element
Get the value of a custom data attribute
Set the value of a custom data attribute
.removeAttr()
.click()
.clone()
Makes a copy of an element
Shortened version
.html()
Gets the html inside an element
Replaces the html inside an element
Clears out the html inside an element
.empty()
.wrap()
.unwrap()
.replaceWith()
Replace with existing element
Replace with new element
.prop()
Sets checkbox to checked
Sets checkbox to unchecked
Get value of checkbox
Get state of checkbox
.height()
Get the height of an element
Set the height of an element
.width()
Get the width of an element
Set the width of an element
.show()
.hide()
.toggle()
.focus()
.blur()
.submit()

Last updated