<script> $(document).ready(function () { var htmlStr = '<div id="outerDiv"><div class="class1"><a>aa</a></div><div class="class1"><span>bb</span></div><div>cc</div></div>' var htmlObj = $(htmlStr); //将字符串转为jquery的dom对象 console.log(htmlObj.html()); var filterObj = htmlObj.find(".class1"); //对转换后的对象进行查询 console.log(filterObj); alert($(filterObj[0]).html()); //<a>aa</a> alert($(filterObj[1]).html()); //<span>bb</span> }); </script>