84669 人が学習中
152542 人が学習中
20005 人が学習中
5487 人が学習中
7821 人が学習中
359900 人が学習中
3350 人が学習中
180660 人が学習中
48569 人が学習中
18603 人が学習中
40936 人が学習中
1549 人が学習中
1183 人が学習中
32909 人が学習中
キーワード検索機能を作成するには
业精于勤,荒于嬉;行成于思,毁于随。
如果只是那种很普通的高亮。。。 可以这样做:
.hl { background-color: yellow; }
<p class="search-result">搜索结果: SegmentFault ( www.sf.gg ) 是中国领先的开发者社区。 我们希望为中文开发者提供一个纯粹、高质的技术交流平台, 与开发者一起学习、交流与成长,创造属于开发者的时代!</p>
function light($sel, keyword, hightLightClass){ var text = $sel.html(); var temp = text.split(keyword).join(`<span class="${hightLightClass}">${keyword}</span>`); $sel.html(temp); } light($('.search-result'), '交流', 'hl');
如果只是那种很普通的高亮。。。 可以这样做:
试例