jq 比较元素列表并找出奇数
你好,有没有一种方法可以比较一些元素,
假设
<ul>
<li>Cat</li>
<li>Dog</li>
</ul>
我使用 ajax,它会返回
<ul>
<li>Ant</li>
<li>Cat</li>
<li>Dog</li>
<li>Fish</li>
</ul>
我需要闪烁 ant
和 fish
来表明它们是新的。
有什么想法吗?
hi is there a way to compare a few elements
lets say
<ul>
<li>Cat</li>
<li>Dog</li>
</ul>
if i use ajax it returns
<ul>
<li>Ant</li>
<li>Cat</li>
<li>Dog</li>
<li>Fish</li>
</ul>
i need to blink ant
and fish
to indicate they are new there.
any ideas ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
它不是很明显你想要什么,但也许是这样的(在现有的 ul 中查找 li 的匹配文本,并为找到的新 li 添加一个类“new”并将它们附加到现有的 ul 中?):
Its not quite obvious what you want, but maybe something like this (looks for matching text of li in existing ul ands add a class 'new' for new li's found and append them to the existing ul?) :