Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

call function in jquery plugin from iframe

How do i call a JQuery plugin function from within an iframe?

 (function($){

         $.fn.jqueryEx = function() {

               function CallThisFunctionFromIframe(){
               }

         }



 })(jQuery);

Edit

The iframe is on the same domain as parent document.

like image 982
redoc01 Avatar asked Apr 17 '26 01:04

redoc01


1 Answers

(function($){

     $.fn.jqueryEx = function() {


         $.fn.jqueryEx .CallThisFunctionFromIframe= function() {

             alert('hello');

         }  

     }


 })(jQuery);

Call this from within the iframe

 $(document).ready(function() {

     window.parent.$.fn.jqueryEx.CallThisFunctionFromIframe();

 });
like image 56
redoc01 Avatar answered Apr 18 '26 15:04

redoc01



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!