Latest web development tutorials

jQuery element ~ siblings selector

jQuery selector jQuery selector

Examples

Select <div> element at the same level all the <p> element:

$("div ~ p")

try it"

Definition and Usage

( "Element ~ siblings") picker to select the specified element "element" of all elements at the same level.

such as:

  • $ ( "div ~ p") - Select <div> element at the same level for all <p> elements.

Note: Two elements specified share the same parent element.


grammar

(" element ~ siblings ")

参数 描述
element 必需。任何有效的 jQuery 选择器。
siblings 必需。规定element参数的同级。


jQuery selector jQuery selector