I have been strugeling with this for a while now so I'm hopeing I can find a solution here.
I wish to open and external URL into an iframe in a colorbox popup. This is all working fine. I just want to run a post loaded function that get rid of any content (such as header and body tags) that I dont need. Here is what I have so far:
$('a[href*="/return-policy"]').colorbox({
href: "/return-policy?language=" + lang,
width: "800px",
height: "600px",
scrolling: false,
iframe: true
});
This returns this:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>title</title>
</head>
<body>
<div>load of crap I dont need</div>
<div class="content-content colorbox-content" id="content-content">
THE STUFF I NEED
</div>
<div>load of crap I dont need</div>
</body>
</html>
This is all I require (in colorbox-content
including the div colorbox-content
):
<div class="content-content colorbox-content" id="content-content">
THE STUFF I NEED
</div>
Any help with this is greatly appreciated.
Thanks C
Try this:
$('a[href*="/return-policy"]').colorbox({
href: "/return-policy?language=" + lang + " #content-content",
width: "800px",
height: "600px",
scrolling: false
});
var your_result= $("div").append($("#content-content")).html()
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.