如何计算< li>的数量使用Javascript通过ajax返回? [英] How to count the number of <li> returned through ajax using Javascript?
本文介绍了如何计算< li>的数量使用Javascript通过ajax返回?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个ajax代码,它将列表项返回为
I have a ajax code which returns the list items as
<li>one</li>
<li>Two</li>
每次返回不同数量的< li>
的。我想查看它返回的< li>
的数量。如何使用Javascript检查它。请帮忙。
Each time it will return different number of <li>
's. I want to check the number of <li>
it returns. How to check it using Javascript. Please Help.
推荐答案
这里你去:
$(returnedHTML).find('li').length
这需要returnHTML并且只计算其中的订单项。
This takes the returnedHTML and only counts the line items within it.
这篇关于如何计算< li>的数量使用Javascript通过ajax返回?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文