I want to print the entire element including tag name, attribute name/value pairs and innerHTML. How can I do it in JavaScript (jQuery)?
for example:
var elArr = document.getElementsByTagName('link');
alert(elArr[0].printEntireElement());
//expected output might be
<link href="/css/common.css" rel="stylesheet" type="text/css">`
Note that for link element outerHTML is not defined!
Open the web page. 2. Press Ctrl + A 3. Right click on the page and left click on “Print” 4.
Window print() Method The print() method prints the contents of the current window. The print() method opens the Print Dialog Box, which lets the user to select preferred printing options.
Use an outerHTML jQuery plugin, like this one, or this one.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With