1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

jQueryでXML操作するとき、findばっかりな件について

Posted at

qiitaで「jquery xml」で検索すると、findを使ってデータを探すのが主流らしい。

https://qiita.com/7note/items/3f69c5ad833b999e424a
※すみません、勝手に例として使わせていただいてます。

sample.html
 $(result).find("item").each(function() {
  $(".XMLRequest").append('<h3>' + $(this).find('title').text() + '</h3>' + '<p>' + $(this).find('link').text() + '</p>');
  });

どこで見かけたのか忘れたけど、find使わなくても書ける。

sample.html
 $(result).find("item").each(function() {
  $(".XMLRequest").append('<h3>' + $('title', this).text() + '</h3>' + '<p>' + $('link', this).text() + '</p>');
  });

こんな感じで一般的ではないけど使えるテクニックって他にもありそう。マイナーな技術っぽいので、知っていたらおしえてください。

1
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
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?