I have a page that loads few iframe's within itself. Each iframe can invoke parent function. For example like this:
$(document).ready(function() {
parent.test();
}
I want to be able to find which iframe invoked test function. I've tried to play with calleer.called properties but the best I could get is the function that calling test(). In my case it was $(document).ready function. Is there a way to get the name of iframe (or it's html name) which calling the function?
If you pass a parameter to the test function it will work:
$(document).ready(function() {
parent.test('name of this iframe');
}
OR even better
$(document).ready(function() {
parent.test(window.name);
}
Then you just need to use that value passed to the inside of the test function.
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.