Lets say I have the following markup:
<html>
    <head>
        <title>Page Title</title>
    </head>
    <body>
        <h1>Some title</h1>
        <p>First paragraph</p>
        <p>Second paragraph</p>
    </body>
<html>
I need to mark some parts of the text, namely "irst paragraph secon" It would look something like this:
<html>
    <head>
        <title>Page Title</title>
    </head>
    <body>
        <h1>Some title</h1>
        <p>F
            <mark>
                irst paragraph</p><p>Secon
            </mark>
        d paragraph</p>
    </body>
<html>
But the problem is be the html markup would be broken. The more complex the markup, the more problems this approach would have.
Question:
Looking for ideas on how can I take the first HTML example and apply a function to return a html structure where "irst paragraph second" is specifically marked somehow.
What I currently have is:
If you want to highlight text in a document then this plug-in will be helpful for you.
https://github.com/julmot/jquery.mark
Example fiddle: https://jsfiddle.net/julmot/vpav6tL1/
Usage is as simple as:
$(".context").mark("keyword");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With