0

I have an iframe in wordpress admin post page and sortable element going to be inside the iframe. jQuery sortable UI working fine out site the iframe but not working inside the iframe. it is giving an error like "sortable is not a function"

2 Answers 2

0

Depends on what the IFRAME is and how you made it. IFRAME is basically a completely new page and you need to load JavaScript, CSS and everything else inside it, it will not use the JS and CSS from the page it is loaded into.

3
  • Hi Milan, I have already tried what you are suggesting, i enqueued the supporting files to the page which i'm lodging inside the iframe like shown below. wp_enqueue_script( array("jquery", "jquery-ui-core", "jquery-ui-sortable", "underscore", "select2") ); but stil it was giving an error like "sortable is not a function" Sep 6, 2017 at 2:52
  • For wp_enqueue_script to work, it has to be WordPress front end page - theme powered, with wp_head, wp_footer actions. Enqueue scripts can't just magically work, it requires full theme based page. What page you load in IFRAME? Sep 6, 2017 at 8:25
  • Petwovic, yes i'm loading theme based page which is a part of front end. Sep 6, 2017 at 9:46
0

i resolved the issue myself by enqueuing external UI framework link https://code.jquery.com/ui/1.12.1/jquery-ui.js

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.