Skip to content

Archives

  • 2022年1月
  • 2021年12月
  • 2021年11月
  • 2021年10月
  • 2021年9月

Categories

  • カテゴリーなし
Trend RepositoryArticles and guides
Articles

.prev()

On 11月 24, 2021 by admin

DOM要素のセットを表すjQueryオブジェクトが与えられると、.prev()メソッドはDOMツリー内のこれらの要素のそれぞれの先行者を探し、一致する要素から新しいjQueryオブジェクトを構築します。

このメソッドはオプションとして$()関数に渡すことができる同じ型のセレクター表現を受け取ります。 セレクタが提供される場合、先行する要素は、それがセレクタに一致するかどうかをテストすることによってフィルタリングされます。

単純なリストがあるページを考えてみましょう。

1
2
3
4
5
6
7

項目3の直前の要素を選択する。

1

この呼び出しの結果は、アイテム2の後ろに赤い背景があることです。 セレクタ式が供給されないので、この先行する要素はオブジェクトの一部として明確に含まれます。

If no previous sibling exists, or if the previous sibling element does not match a supplied selector, an empty jQuery object is returned.

To select all preceding sibling elements, instead than the just preceding adjacent sibling, use the .prevAll() method.

If no sibling, if one was supplied, the element be tested for match before it were included.

If no sibling is no previous is in the single single sibling and the element for a single sibling, for the previous sibling and the element is not match the match of an single sibling.

コメントを残す コメントをキャンセル

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です

アーカイブ

  • 2022年1月
  • 2021年12月
  • 2021年11月
  • 2021年10月
  • 2021年9月

メタ情報

  • ログイン
  • 投稿フィード
  • コメントフィード
  • WordPress.org
  • DeutschDeutsch
  • NederlandsNederlands
  • SvenskaSvenska
  • DanskDansk
  • EspañolEspañol
  • FrançaisFrançais
  • PortuguêsPortuguês
  • ItalianoItaliano
  • RomânăRomână
  • PolskiPolski
  • ČeštinaČeština
  • MagyarMagyar
  • SuomiSuomi
  • 日本語日本語

Copyright Trend Repository 2022 | Theme by ThemeinProgress | Proudly powered by WordPress