Problem when combining droppable & draggable in JS

0

I have the following code:

<html>

<head>
    <script type="text/css" href="..css/jquery-ui.css"></script>
    <script type="text/javascript" src="../jquery.js"></script>
    <script type="text/javascript" src="../jqueryui.js"></script>
    <script type="text/javascript">
       var x;
        x=$(document);
        x.ready(inicio);
        
        function inicio(){
            var x;
            x=$("#muevemueve");
            x.draggable();
            x=$("#sueltame");
            x.droppable({drop:soltado});
        }
        
        function soltado(){
            var x=${"#sueltame"};
            //x.css("background","red");
        }
        
    </script>
    <style type="text/css">
        #muevemueve{
            width: 100px;
            height: 100px;
            border: 1px solid black;
        }
        #sueltame{
            width: 300px;
            height: 300px;
            border: 1px solid black;
            background: yellow;
            margin: 10px;
        }
    </style>
</head>

<body>
    <div id="muevemueve">Mueveme</div>
    <div id="sueltame">Suelta algo encima de mi</div>
</body>
    
</html>

The method "x.draggable ();" it works but when I insert the "released" function it stops working and draggable droppable does not work.

In advance, thanks for your support.

Good day Luis

    
asked by Luis Miguel Sanchez Alzamora 23.12.2017 в 21:39
source

1 answer

0

You have a syntax error. Use parentheses, not chorchetes:

var x=$("#sueltame");
    
answered by 24.12.2017 в 03:47