ホームページ  >  記事  >  ウェブフロントエンド  >  jQuery_jqueryのnext()メソッドの使用例

jQuery_jqueryのnext()メソッドの使用例

WBOY
WBOYオリジナル
2016-05-16 16:21:461259ブラウズ

この記事の例では、jQuery での next() メソッドの使用法について説明します。皆さんの参考に共有してください。具体的な分析は次のとおりです。

このメソッドは、一致した要素のセット内の各要素のすぐ隣の兄弟要素を取得します。
オプションの式を使用して、兄弟要素のコレクションをフィルター処理することもできます。

文法構造:

コードをコピーします コードは次のとおりです:
$(selector).next(expr)

パラメータリスト:

参数 描述
expr 可选。用于筛选的表达式

Example code:

Example 1:

Copy code The code is as follows:






next() function-Script Home






I am the p element


I am the span element

I am the p element


I am a div element




Set the font color in the elements immediately adjacent to each p element to blue.

Example 2:

Copy code The code is as follows:






next() function-Script Home






I am the p element


I am the span element

I am the p element


I am a div element




Set the font color in the span element immediately adjacent to the p element to blue.

I hope this article will be helpful to everyone’s jQuery programming.

声明:
この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡ください。