Javascript: $('body:contains("")') with html

I want to use `$('body:contains("")')` for searching part of a html code. For example: var thing = $('body:contains("Web")').text() if(thing) { alert(thing); } else{ alert("not found") } This code always alerts "not found". Is it possible to search a part of a html code and alert if found? Thank you...
Beware that you may see "Web", when inspecting with your browser, but the actual code may contain whitespace or not even have closing tags! Even if the source is "Web" now, stuff like that can break very easily on pages that you do not control.

以上就是Javascript: $('body:contains("")') with html的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » JavaScript 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准