I am trying to add "selectionchange" eventlistener to iframe in react js but for some reason it is not added to it
Here's my component:
export const Page = (props) => {
const iframeref = useRef();
useEffect(() => {
const doc = iframeref.current;
doc.contentDocument.addEventListener("selectionchange", () => {
console.log("hello");
});
}, []);
return (
<>
<iframe
className='book-page'
ref={iframeref}
src='c006.xhtml'
></iframe>
</>
);
};