Unable to use jQueryUI

This is what I have at the top of /theme/test_theme/view/layout.phml

<?php
$escape = $this->plugin('escapeHtml');
$siteTitle = $site->title();
$this->htmlElement('html')->setAttribute('lang', $this->lang());
$this->headMeta()->setCharset('utf-8');
$this->headMeta()->appendName('viewport', 'width=device-width, initial-scale=1');
$this->headTitle($siteTitle)->setSeparator(' · ');
$this->headTitle()->append($this->setting('installation_title', 'Omeka S'));
$this->headLink()->prependStylesheet($this->assetUrl('css/style.css'));
$this->headLink()->prependStylesheet($this->assetUrl('css/iconfonts.css', 'Omeka'));
$this->headLink()->prependStylesheet('//fonts.googleapis.com/css?family=Open+Sans:400,400italic,600,600italic,700italic,700');
$this->headLink()->appendStylesheet($this->assetUrl('jquery-ui.min.css', 'jQueryUI'));
$this->headScript()->prependFile($this->assetUrl('js/default.js'));
$this->headScript()->prependFile($this->assetUrl('js/global.js', 'Omeka'));
$this->headScript()->prependFile($this->assetUrl('vendor/jquery/jquery.min.js', 'Omeka'));
$this->headScript()->prependFile($this->assetUrl('jquery-ui.min.js', 'jQueryUI'));
$this->jsTranslate();
$this->trigger('view.layout');
$userBar = $this->userBar();

When I try and use it in a block, I get the following in the console:
jquery.min.js:2 Uncaught TypeError: $(…).tabs is not a function
at HTMLDocument. (intro:148)
at e (jquery.min.js:2)
at t (jquery.min.js:2)

When I inspect the HTML head I see the foilowing

<script type="text/javascript" src="/modules/Sharing/asset/js/sharing.js?v=1.2.0"></script>
<script type="text/javascript" src="/modules/jQueryUI/asset/jquery-ui.min.js?v=1.12.1"></script>

Both files are present, there are no 404 messages.

Note, you’re using prependFile to load your scripts, so the scripts will basically be in the reverse order that you list them in the layout file. So if you want to load jQuery then jQuery UI the way you’re doing it here, you need to actually put the jQuery UI line before the jQuery line.

This topic was automatically closed 250 days after the last reply. New replies are no longer allowed.