2016-03-30 5 views

答えて

5

あなたはとてもfind()は彼らに

var html = '<a href="http://foo.example.com">Foo/a> | ' + 
 
    '<a href="http://bar.example.com">Bar</a>'; 
 
var aTags = $(html).filter('a'); 
 
snippet.log(aTags.length); // => 0
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> 
 
<!-- Provides the `snippet` object, see http://meta.stackexchange.com/a/242144/134069 --> 
 
<script src="http://tjcrowder.github.io/simple-snippets-console/snippet.js"></script>
を見つけることができませんjQueryオブジェクトが参照する要素の子孫要素を見つけるために filter() find()ための試行を使用する必要がある、あなたの文字列に a要素がルートであります

関連する問題