filer --jquery

mac2022-06-30  94

1 2 3 4 5 6 7 8 9 10 <ul> <li><strong>list</strong> item 1 - one strong tag</li> <li><strong>list</strong> item <strong>2</strong> - two <span>strong tags</span></li> <li>list item 3</li> <li>list item 4</li> <li>list item 5</li> <li>list item 6</li> </ul>

We can select the list items, then filter them based on their contents:

1 2 3 $('li').filter(function(index) { return $('strong', this).length == 1; }).css('background-color', 'red');

转载于:https://www.cnblogs.com/yanjunwu/archive/2013/04/12/3015855.html

相关资源:HTML5文件上传组件美化jQuery插件
最新回复(0)