How to highlight text using javascript

后端 未结 13 2539
名媛妹妹
名媛妹妹 2020-11-22 02:32

Can someone help me with a javascript function that can highlight text on a web page. And the requirement is to - highlight only once, not like highlight all occurrences of

13条回答
  •  孤城傲影
    2020-11-22 03:08

    We if you also want it to be highlighted on page load, there is a new way.

    just add #:~:text=Highlight%20These

    try accessing this link

    https://stackoverflow.com/questions/38588721#:~:text=Highlight%20a%20text

提交回复
热议问题