I'm working on a plugin and encountered a problem where trying to make use of the jQuery UI Sortable. I followed the instruction as in <a href="http://codex.wordpress.org/Function...cripts_Only_on_a_Plugin_Administration_Screen" rel="noreferrer">Codex</a> but issue remained. The jQuery UI sortable does not function and Firebug says
.
I'm running on WordPress 3.6 and the code is:
Code:
TypeError: jQuery(...).sortable is not a function
I'm running on WordPress 3.6 and the code is:
Code:
<?php
/*
Plugin Name: Name
Description: Description
Version: 0.1
Author: Bloorchi
*/
add_action( 'admin_menu', 'my_plugin_admin_menu' );
function my_plugin_admin_menu() {
add_action('admin_print_scripts-' . $page_hook_suffix, 'my_plugin_admin_scripts');
$page_hook_suffix = add_submenu_page( 'edit.php', 'My Plugin', 'My Plugin', 'manage_options', 'my_plugin-options', 'my_plugin_manage_menu' );
}
function my_plugin_admin_scripts() {
wp_enqueue_script( 'jquery-ui-sortable' );
}
function my_plugin_manage_menu() {
?>
<table id="test">
<tbody>
<tr>
<td>1</td>
<td>2</td>
</tr>
<tr>
<td>3</td>
<td>4</td>
</tr>
<tr>
<td>5</td>
<td>6</td>
</tr>
<tbody>
</table>
<script>
jQuery('table#test tbody').sortable();
</script>
<?php
}