jQuery plug in EasyUI gets the method of iframe form object in current Tab

  • 2021-07-09 06:45:40
  • OfStack

This article illustrates how the jQuery plug-in EasyUI obtains the iframe form object in the current Tab. Share it for your reference, as follows:

When we use the EasyUI Tabs framework, we need to operate the iframe form content or method of the current Tab in the pop-up form at the top of the framework. At this time, we can use the following methods to achieve it.

The specific implementation code is as follows:


function getTabWindow() {
  var curTabWin = null;
  var curTab = parent.$('#main-center').tabs('getSelected');
  if (curTab && curTab.find('iframe').length > 0) {
    curTabWin = curTab.find('iframe')[0].contentWindow;
  }
  return curTabWin;
}

Call mode:

1. Call the testMth method of the iframe form in the current Tab:


getTabWindow().testMth();

2. Set the of the iframe form in the current Tab < span id="testPanel" > < /span > Content of:


getTabWindow().$('#testPanel').html(' I am setting the content! ! ! ');

For more readers interested in jQuery related content, please check the topics of this site: "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: