'Pull only text element into iframe
I have this IFrame HTML code that may have errors!
<iframe src="https://www.waterstreetgallery.co.uk/en/brands/anita-j-burrows/"#artist-info" style= frameborder="0" scrolling="no" width="650px" height="400px" align="center" ></iframe>
I am trying to pull only a text wrapped in a div class here
<div class="artist-info">
<p>As an artist who has trained in Fine Art and subsequently returned to printmaking I find the idea of connecting Fine Art and Craft particularly interesting. Printmaking has often straddled this ideal of creative practice incorporating fine art thoughts into craft led processes of making printing plates. My work is inspired by the natural environment I am particularly drawn to trees and the play of light on surfaces at the beginning and end of the day when shadows are long and light is very contrasty. I make printing plates from lino, aluminium, zinc and card as well as exploring lithographic techniques. As I work in a small studio I am interested in safer ways of printmaking and to that end I have been exploring acrylic resists and photoploymer.</p>
</div>
This is the page where it is displaying the iframe https://www.waterstreetgallery.co.uk/en/
the 5th block on the home page "Our Gallery Artists" and it is the second slider.
Our home page only allows a minimum number of total characters in each text element as you can see on the other slider it is cut off "and the changing li"
So as the workaround I have this the iframe approach. The aim is to only show the text wrapped in the div class shown here and no header or cookies / chat overlays.
https://www.waterstreetgallery.co.uk/en/brands/anita-j-burrows/
For clarification I am inputing the code into a text field - It handles HTML fine but needs tags.
Thank you in advance for any help for any working solution that we use we can provide a $50 gesture.
Solution 1:[1]
You should use iframe content window see: https://developer.mozilla.org/en-US/docs/Web/API/HTMLIFrameElement/contentWindow
document.querySelector('iframe[ src="https://www.waterstreetgallery.co.uk/en/brands/anita-j-burrows/"]').contentWindow.document.querySelector('.artist-info').innerText
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | ShobiDobi |

