event.target doesn't work

Posted by rdesign on Stack Overflow See other posts from Stack Overflow or by rdesign
Published on 2010-04-29T16:51:45Z Indexed on 2010/04/29 16:57 UTC
Read the original article Hit count: 427

Filed under:
|
|
|

Hey guys,

I've wrote some jquery code with some draggable elements and one droparea.

Unfortunately my droparea can't make a difference between various object.

Here's my code.

<script type="text/javascript">

    $(function() {

        $("#droparea").droppable({
            drop: function(event) {
                var $target = $(event.target);

                if($target.is("#flyer")) {
                    alert("adasd");
                }
            }
        });

    });


</script>

</head>
<body>
<div id="droparea"></div>

<div class="polaroid" id="flyer">
    <img src="images/muesliFlyer.png" alt="flyer" />
</div>

Without the if it works. But then I can't get the dropped object.

Any ideas why my target isn't recognized?

thanks a lot.

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about event