Uncaught TypeError: $.widget is not a function in WordPress Theme

I’m planning to use jQuery autocomplete combo in theme. Loaded script files as follow in header.php

<link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
<script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>

When I try it I got javascript error as Uncaught TypeError: $.widget is not a function. This is jquery ui autocomplete demo and I try it at JSFiddle also worked as demo. That’s JSFiddle working demo. I got $.widget error When I add it in wordpress theme. How can I fix it

Related posts

2 comments

  1. you need to call jquery ui widget in theme’s functions.php

    wp_enqueue_script('jquery-ui-widget');
    

Comments are closed.