jQuery specifies the method within the iframe page based on the ID call

  • 2021-07-02 23:04:40
  • OfStack

This article example shows how jQuery specifies methods within an iframe page based on ID calls. Share it for your reference, as follows:

$(window.parent.document).contents().find("#iframeID")[0].contentWindow.initPagerList();

Description:

iframeID is ID of iframe;

initPagerList is the method within the iframe page.


<html>
<head>
 <title></title>
 <script>
  $(function(){
    /*
      Description:  iframeID  For iframe Adj. ID ; 
     initPagerList  For  iframe  Methods within the page. 
    */
    // Call iframe Page iframeID In initPagerList Method 
    $(window.parent.document).contents().find("#iframeID")[0].contentWindow.initPagerList();
    // Get iframe Page iframeID Text box in txtControlID Object 
    var txtControlObj=$(window.parent.document).contents().find("#iframeID")[0].contentWindow.find("#txtControlID");
    // For iframe Page iframeID Text box in txtControlID Assignment 
    txtControlObj.val(" I am the content value you need to set! ");
  });
 </script>
</head>
<body>
</body>
</html>

For more readers interested in jQuery related content, please check the topics of this site: "Summary of jQuery Operation iframe Skills", "Summary of jQuery Extension Skills", "Summary of jQuery Common Plug-ins and Usage", "Summary of jQuery Drag Effects and Skills", "Summary of jQuery Table (table) Operation Skills", "Summary of Ajax Usage in jquery", "Summary of jQuery Common Classic Special Effects", "Summary of jQuery Animation and Special Effects Usage" and "Summary of jquery Selector Usage"

I hope this article is helpful to everyone's jQuery programming.


Related articles: