8.4.2 TypeError: $(...).selectmenu is not a function

Permalink
I don't seem to have luck with select widgets. I have another error in a block: TypeError: $(...).selectmenu is not a function.

view (example strait from jquery-ui site):
<label for="speed">Select a speed:</label>
<select name="speed" id="speed">
  <option value="Slower">Slower</option>
  <option value="Slow">Slow</option>
  <option value="Medium" selected>Medium</option>
  <option value="Fast">Fast</option>
  <option value="Faster">Faster</option>
</select>
<script>
$( "#speed" ).selectmenu();
</script>

controller:
public function registerViewAssets($outputContent = '')
    {
        $this->requireAsset('javascript', 'jquery');
        $this->requireAsset('javascript', 'jquery-ui');
        $this->requireAsset('css', 'jquery-ui');
    }

What else am I missing?

Thank you.

linuxoid
 
JohntheFish replied on at Permalink Reply
JohntheFish
You are missing an asset. At a guess, something to do with bootstrap menus.
linuxoid replied on at Permalink Reply
linuxoid
Bootstrap? 'selectmenu' is a jquery-ui widget, not bootstrap's.
JohntheFish replied on at Permalink Reply
JohntheFish
OK.
Check the c5 version of jQuery.ui is actually built with that function.

If it is not present, you will need to either provide your own version of ui - dangerous, because it could get in the way core functionality, or create an asset just containing that function and any missing dependencies.

If it is present, the error still means you are missing an asset, so are either not loading it, or trying to use it before it is loaded.