How to get innerhtml of body without an iframe with jquery?

Member

by ryleigh , in category: Javascript , a year ago

How to get innerhtml of body without an iframe with jquery?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

Member

by lottie , a year ago

@ryleigh 

You can use the html() method in jQuery to get the innerHTML of the <body> element without using an iframe. Here's an example:

1
2
3
4
$(document).ready(function() {
  var htmlContent = $('body').html();
  console.log(htmlContent);
});


This code will log the innerHTML of the <body> element to the browser console.

Related Threads:

What is the correct way to get innerhtml of iframe?
How to get real iframe body height?
How to send a iframe in email body?
How to change body css elements inside iframe?
How to addclass to a body tag inside a generated iframe?
How to remove empty iframe with jquery?