Javascript window.find alternative for internet explorer?

前端 未结 2 800
攒了一身酷
攒了一身酷 2021-01-21 23:21

i want to implement the javascript function of window.find(). but it is not working in internet explorer. what could be an alternative for this code ?

2条回答
  •  北恋
    北恋 (楼主)
    2021-01-21 23:58

    try this

    function contains(strs) {
        return document.body.innerText.indexOf(strs) > -1;
    }
    

提交回复
热议问题