Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

how to add event listener to iframe

var iframe = document.getElementById('myIFrame');
iframe.contentWindow.body.addEventListener('mouseup', Handler);

function Handler() {
    alert('works');
}
Comment

apply eventlistener to iframe

var iframe = document.getElementsByTagName('iframe')[0],
    iDoc = iframe.contentWindow     // sometimes glamorous naming of variable
        || iframe.contentDocument;  // makes your code working :)
if (iDoc.document) {
    iDoc = iDoc.document;
    iDoc.body.addEventListener('afterLayout', function(){
                        console.log('works');
                });
};
Comment

PREVIOUS NEXT
Code Example
Javascript :: toggle state react 
Javascript :: mongoose find sort 
Javascript :: filter nested object array and return whole object 
Javascript :: nodejs javascript heap out of memory 
Javascript :: discord.js edit message by id 
Javascript :: clear all intervals js 
Javascript :: lodash empty string 
Javascript :: js check if string includes from array 
Javascript :: how to add data to file json in python 
Javascript :: .includes( string 
Javascript :: check local storage javascript 
Javascript :: vue config devtools 
Javascript :: get random item from array javascript 
Javascript :: tcp listen node 
Javascript :: js for loop array 
Javascript :: js tab character 
Javascript :: stripe react js 
Javascript :: statement and expression in js 
Javascript :: jquery after 
Javascript :: pass props in link next js 
Javascript :: lorem ipsum json api 
Javascript :: $(window).scrolltop() not working on mobile 
Javascript :: preload javascript 
Javascript :: js to lowercase 
Javascript :: unity javascript 
Javascript :: filter out object in array using two arguments 
Javascript :: js map array to dictionary 
Javascript :: bootstrap datepicker mindate 
Javascript :: dynamic loop variable .each create hash javascript 
Javascript :: js loop over array of objects extract value 
ADD CONTENT
Topic
Content
Source link
Name
2+9 =