選取 <div> 元素同級的所有 <p> 元素:
$("div ~ p")
("element ~ siblings") 選擇器選取指定元素 "element" 同級的所有元素。
比如:
$("div ~ p") - 選取 <div> 元素同級的所有 <p> 元素。
("element ~ siblings")
參數
element 必需。任何有效的 jQuery 選擇器。
siblings 必需。規定 element 參數的同級。
image.png