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
jQuery(document)
code? Doestag-it.js
use the$
alias? Have you checked the console for Javascript errors?