Uncaught TypeError: $(...).draggable is not a function

zouzou b lebiane

hello everyone i am trying to make some divs draggable and i have managed to do that with jquery-ui. i also have a script that removes 2 divs and combine them in a single one (like if they have been merged together) but when i call the draggable function on the new "merged" div i get the error is the title... so what is the problem ? how is it possible that .draggable function work one place and not in an other (on the same file)!!

this is the draggable function:

function drag($class){
$("."+$class).draggable({
containment: ".tab-content",
grid: [ 3, 3 ],
zIndex:100,
obstacle: "#nothere",
preventCollision: true,
drag:
function(){
    $(".test").css("background-color","red");
    $(this).css("background-color","green");
    }

});
} 

first i called it for the test class which work perfectly with no error

drag("test");

but when i call it another time inside the merge function it return the error: Uncaught TypeError: $(...).draggable is not a function

drag("test:not(.ui-draggable)");

the js file are loaded properly:

<script type="text/javascript" src="js/jquery-2.1.4.min.js"></script>
<script type="text/javascript" src="js/jquery-ui.min.js"></script>
Gary

I know this is an old question but since I had the same problem and couldn't find the answer...

I had all of the correct scripts included, checked that the links were valid etc and it still wasn't working.

I then moved the script references to be directly above the code that calls .draggable and.. it works perfectly.

<link rel="stylesheet" href="https://code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.min.css"/>
        <script type="text/javascript" src="https://code.jquery.com/jquery-1.12.4.min.js" />
        <script type="text/javascript" src="https://code.jquery.com/ui/1.12.1/jquery-ui.min.js" />

        <script type="text/javascript">
            $(function () {
                $(".regionStyle li").draggable();
                $(".regionStyle").droppable({
                    drop: function (event, ui) {
                        $(this)
                        .addClass("ui-state-highlight")
                        .find("p")
                        .html("Item Dropped!");
                    }
                });
            });

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Jquery Uncaught TypeError: $(...).draggable is not a function

From Dev

Uncaught TypeError: $(...).stellar is not a function

From Dev

Uncaught TypeError: $.growl is not a function

From Dev

Uncaught TypeError: #<Object> is not a function

From Dev

Uncaught TypeError:Undefined is not a function

From Java

Uncaught TypeError: $.post is not a function

From Dev

Uncaught TypeError: $(...).tokenfield is not a function

From Dev

Uncaught TypeError: $(...).velocity is not a function

From Dev

Uncaught TypeError: $(...).ready is not a function

From Dev

Uncaught TypeError: undefined is not a function

From Dev

Uncaught TypeError: undefined is not a function

From Dev

Uncaught TypeError: Object function

From Dev

Uncaught TypeError: number is not a function

From Dev

Uncaught TypeError: $(…).on is not a function

From Dev

Uncaught TypeError: undefined is not a function

From Dev

jQuery - Uncaught TypeError: $ is not a function

From Dev

Uncaught TypeError: $(...).autocomplete is not a function

From Dev

uncaught typeerror $(...).swipe is not a function

From Dev

Uncaught TypeError: MyView is not a function

From Dev

Uncaught TypeError: response is not a function

From Dev

Uncaught TypeError: method is not a function

From Dev

Uncaught TypeError: $(this).search is not a function

From Dev

Uncaught TypeError: lang is not a function

From Dev

Uncaught TypeError: undefined is not a function

From Dev

Uncaught TypeError: undefined is not a function

From Dev

Uncaught TypeError: undefined is not a function?

From Dev

Uncaught TypeError: undefined is not a function $

From Dev

Javascript: Uncaught TypeError: not a function

From Dev

Uncaught TypeError: a(...).countdown is not a function

Related Related

  1. 1

    Jquery Uncaught TypeError: $(...).draggable is not a function

  2. 2

    Uncaught TypeError: $(...).stellar is not a function

  3. 3

    Uncaught TypeError: $.growl is not a function

  4. 4

    Uncaught TypeError: #<Object> is not a function

  5. 5

    Uncaught TypeError:Undefined is not a function

  6. 6

    Uncaught TypeError: $.post is not a function

  7. 7

    Uncaught TypeError: $(...).tokenfield is not a function

  8. 8

    Uncaught TypeError: $(...).velocity is not a function

  9. 9

    Uncaught TypeError: $(...).ready is not a function

  10. 10

    Uncaught TypeError: undefined is not a function

  11. 11

    Uncaught TypeError: undefined is not a function

  12. 12

    Uncaught TypeError: Object function

  13. 13

    Uncaught TypeError: number is not a function

  14. 14

    Uncaught TypeError: $(…).on is not a function

  15. 15

    Uncaught TypeError: undefined is not a function

  16. 16

    jQuery - Uncaught TypeError: $ is not a function

  17. 17

    Uncaught TypeError: $(...).autocomplete is not a function

  18. 18

    uncaught typeerror $(...).swipe is not a function

  19. 19

    Uncaught TypeError: MyView is not a function

  20. 20

    Uncaught TypeError: response is not a function

  21. 21

    Uncaught TypeError: method is not a function

  22. 22

    Uncaught TypeError: $(this).search is not a function

  23. 23

    Uncaught TypeError: lang is not a function

  24. 24

    Uncaught TypeError: undefined is not a function

  25. 25

    Uncaught TypeError: undefined is not a function

  26. 26

    Uncaught TypeError: undefined is not a function?

  27. 27

    Uncaught TypeError: undefined is not a function $

  28. 28

    Javascript: Uncaught TypeError: not a function

  29. 29

    Uncaught TypeError: a(...).countdown is not a function

HotTag

Archive