0

I'm trying to load tag-it jquery plugin into the wordpress back-end for the category edit page, but for some reason I can't.

The following are snippets of my code:

function tag_category_fields($tag){
    $t_id = $tag->term_id;
    $cat_meta = get_option( "category_$t_id");
    $tag_items_list = individual_tag();
    ?>

    <tr class="form-field">
    <th scope="row" valign="top"><label for="category_tag_list"><?php _e('Available Categary Tags'); ?></label></th>
    <td>
    <form class="category_tag_list_values">
    <select id="list_category_tags" name="list_category_tags" style="width: 300px; padding: 5px; overflow-y: auto;" multiple="multiple">
    <?php foreach($tag_items_list as $tags){ ?>
        <option value="<?php echo $tags->tag_id ?>"><?php echo $tags->name ?></option>
    <?php } ?>    
    </select>
    <br/>
    <input class="uibutton" style="width: 75px" type="button" value="add">
    </form>
    <br />
    </td>
    </tr>
    <tr class="form-field">
    <th scope="row" valign="top"><label for="added_category_tag"><?php _e('Current Category Tags'); ?></label></th>
    <td>
                <input id="myTags" type="text" /><br />
                <p id="status"></p>
                <span class="description"><?php _e('Current Category Tags'); ?></span>
            </td>
    </tr>
    <?php
}

This is the html for the added boxes on the page:

   function my_plugin_admin_init() {
        wp_enqueue_script( 'myTagScript', 
        plugins_url( '/js/tag-it.js' , __FILE__ ));
        wp_enqueue_script( 'myCategoryTagScript', 
        plugins_url( '/js/category_tags.js' , __FILE__ ));
        wp_enqueue_script("myUi","https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.8/jquery-ui.min.js");
   }

function my_plugin_admin_scripts() {
        wp_enqueue_script( 'myTagScript' );
        wp_enqueue_script( 'myCategoryTagScript' );

   }

How I'm loading the scripts for the pages:

jQuery(document).ready(function($){
    $("form :button").click(function() {
    alert($('#list_category_tags').val());
    });


    $('#myTags').tagit();
});

I'm using this plug-in https://github.com/aehlke/tag-it

3
  • Could you please use punctuation and make separate sentences? This is really hard to read and understand. Thank you.
    – kaiser
    Commented Jul 7, 2013 at 11:45
  • Where do you have the jQuery(document) code? Does tag-it.js use the $ alias? Have you checked the console for Javascript errors?
    – s_ha_dum
    Commented Jul 7, 2013 at 15:55
  • I'm using this plugin github.com/aehlke/tag-it, I did try $ alias it didn't seem to work tho but I may have done it wrong.
    – user7715
    Commented Jul 7, 2013 at 17:51

0

Your Answer

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

Browse other questions tagged or ask your own question.