• Resolved am71722

    (@am71722)


    I’ve seen this problem a lot but no one ever comes up with a solution. I’m getting an error saying .sortable/.draggable/.droppable are not functions. Can anyone help? Relevant code below:

    //template page

    <script>
        jQuery(document).ready(function() {
            jQuery("#sortable").sortable({
                revert: true
            });
            jQuery("#draggable").draggable({
                connectToSortable: "#sortable",
                helper: "clone",
                revert: "invalid"
            });
            jQuery("ul, li").disableSelection();
        });
    </script>

    //functions page

    /*load custom javascript*/
    function occ_scripts_method() {
    	wp_enqueue_script('jquery-ui-datepicker');
            wp_enqueue_script('jquery-ui-sortable');
            wp_enqueue_script('jquery-ui-draggable');
            wp_enqueue_script('jquery-ui-droppable');
            wp_enqueue_script(
    		'custom-script',
                    get_stylesheet_directory_uri() . '/lib/js/occscripts.js',
    		array( 'jquery' )
    	);
    
            wp_enqueue_style('jquery-style', 'https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/themes/smoothness/jquery-ui.css');
    }
    add_action( 'wp_enqueue_scripts', 'occ_scripts_method' );

Viewing 1 replies (of 1 total)
  • Thread Starter am71722

    (@am71722)

    I think I understand why this never gets answered. Its because it comes from dumb coding mistakes. I was using head and body tags in my template.

    LESSON: Don’t do that. And pay attention to copy and pasted code.

Viewing 1 replies (of 1 total)
  • The topic ‘jQuery UI – is not a function’ is closed to new replies.