简体   繁体   中英

jquery/javascript code to obtain full text content of main web page(including links texts but excluding images) of a web page

I want to obtain the entire text content of a web page, when the page is open within main window of browser. Is there some way to do this- preferably using jquery, but pure js is also ok for me. I want to obtain both the normal text as well as link texts also- only images should be excluded

Do you mean

$(document).ready(function(){
    var bodyText = $("body").text();
});

http://api.jquery.com/text/

I hope this code help you

$(function(){
    var t = $('body > *').not('img').text()
});

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