$(() => {
$("button").click(() => {
// this will add a border bottom
// to all the children of the div element (the <p> elements)
$('div').children().css("border-bottom", "3px double red")
})
})
Method is used to get the descendant elements of the selected element
The find()
and children()
methods are similar, except that the find()
method search through multiple levels down the DOM tree to the last descendant, whereas the children()
method only search a single level down the DOM tree
$(() => {
$("button").click(() => {
// this will add a border bottom
// to all spans within the div element
$('div').find('span').css("border-bottom", "3px double red")
})
})