I have this part of code in my functions.php:
function cc_admin_enqueue_scripts($hook) {
$file_dir=get_bloginfo('template_directory');
wp_enqueue_script('media-upload');
wp_enqueue_script('thickbox');
wp_enqueue_script( 'farbtastic' );
wp_register_script('my-upload', $file_dir."/functions/scripts/rm_script.js",array('jquery','media-upload','thickbox','farbtastic'));
wp_enqueue_script('my-upload');
wp_enqueue_script('tablednd', $file_dir.'/functions/scripts/jquery.tablednd.js', array('jquery'), '0.5');
wp_enqueue_script( 'jquery-ui-tabs' );
wp_enqueue_script( 'jquery-ui-sortable' );
wp_enqueue_script( 'jquery-ui-droppable' );
wp_enqueue_script( 'jquery-ui-draggable' );
}
add_action('admin_enqueue_scripts', 'cc_admin_enqueue_scripts');
Everything works fine. The rm_script javascript works ok, except I got this error notification in IE:
Object doesn’t support this property or method rm_script.js line 290
in the rm_script.js line 290:
(this is where line 290 starts:)
jQuery(".table_sort").tableDnD({
onDragClass: "myDragClass",
onDrop: function(table, row) {
var $multitable_wrap = jQuery('.table_sort .multitable');
$multitable_wrap.each(function(i) {
var $current_sub_table = jQuery(this);
$current_sub_table.find('.correct_num').each(function(){
var $newname = jQuery(this).attr('name').replace(/\d+/,i);
jQuery(this).attr({'name': $newname,'id': $newname});
});});},
onDragStart: function(table, row) { }
});
the jQuery(“.table_sort”).tableDnD is the source where I got an error. If I delete it, it works just fine, but I need it to support my javascript function.
I’ve declared the jquery.tablednd.js, but somehow .tableDnD function couldn’t be loaded.
It’s apparently a jquery load problem.
Fixed!