Wordpress Uncaught TypeError: undefined is not a function - Jquery Tag-it Plugin

admin

Administrator
Staff member
I am trying to use Tagit Jquery Plugin, <a href="https://github.com/aehlke/tag-it" rel="nofollow">https://github.com/aehlke/tag-it</a>
Also attaching photo if somebody want to see <a href="http://www.imagesup.net/pt-014044890133.png" rel="nofollow">http://www.imagesup.net/pt-014044890133.png</a>

The page where i am using this code is standlone page, and is called by template_redirect wordpress action
My Code is

Code:
jQuery(document).ready(function($){
// Error showing here - Uncaught TypeError: undefined is not a function
 $('#tags').tagit({ availableTags: ["c++", "java", "php", "javascript", "ruby", "python", "c"]});
});

Also i am getting same error at tag-it.source code which is as follow

Code:
$.widget('ui.tagit', {
// Error showing here - Uncaught TypeError: undefined is not a function
    options: {
        allowDuplicates   : false,
        caseSensitive     : true,
        fieldName         : 'tags',
        placeholderText   : null,   // Sets `placeholder` attr on input field.
        readOnly          : false,  // Disables editing.
        removeConfirmation: false,  // Require confirmation to remove tags.
        tagLimit          : null,   // Max number of tags allowed (null for unlimited).

        // Used for autocomplete, unless you override `autocomplete.source`.
        availableTags     : [],

Here is the code for adding scripts to wordpress

Code:
function ds_enqueue_query_scripts(){

        wp_enqueue_script('jQuery');
        wp_enqueue_script( 'tagit',get_template_directory_uri() .'/js/tag-it.min.js', 'jquery' );
        wp_enqueue_style( 'tagitcss', DSCSS . 'tagit.css');
}

add_action('wp_enqueue_scripts', 'ds_enqueue_query_scripts' );

codes apears on page head section, jquery is loading before tagit...which is the way it should be i guess..

Code:
&lt;script type='text/javascript' src='http://myhostlocal/AgamWordpress/wp-includes/js/jquery/jquery.js?ver=1.11.0'&gt;&lt;/script&gt;&lt;script type='text/javascript' src='http://myhostlocal/AgamWordpress/wp-includes/js/jquery/jquery-migrate.min.js?ver=1.2.1'&gt;&lt;/script&gt;&lt;script type='text/javascript' src='http://myhostlocal/AgamWordpress/wp-content/themes/desistation/js/main.js?ver=3.9.1'&gt;&lt;/script&gt;&lt;script type='text/javascript' src='http://myhostlocal/AgamWordpress/wp-content/themes/desistation/js/tag-it.min.js?ver=3.9.1'&gt;&lt;/script&gt;