简体   繁体   中英

Mark.js not highligting the text

I am trying to use mark.js for highlighting text in a specified container.

var searchKeyword = "ipsum";
$(".box").mark(searchKeyword, options);

<div class="box">
<p>
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea
        takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores
</p>
</div>

Mark.Js: https://markjs.io/

Codepen example: https://codepen.io/anon/pen/eVMZyb

Working example

var searchKeyword = "ipsum";
//$(".box").mark(searchKeyword, options);


$(".box").mark(searchKeyword, {
            "element": "span",
            "className": "highlight"
        });

https://codepen.io/anon/pen/mXxPQW

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM