LoginSignup
0
0

More than 5 years have passed since last update.

jQueryメモ

Posted at

class名が同じの時、同じ要素が複数いると、一番最初の要素を見つけたいの場合
.filter(function(){})と.index()を組み合わせの方が便利かも

<span class=name id=reika>reika</span>
<span class=name id=marika>marika</span>
<span class=name id=reika>reika</span>


var ns = $(".name");
    ns = ns.filter(function(i, e){

    return $(".jinmei:contains(" + $(e).text() + ")").index(".name") == i;

    });
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0