开发者

simple jQuery UI drag and drop example

开发者 https://www.devze.com 2023-03-26 03:48 出处:网络
I\'m trying to enable each of the list items classed \"draggable\" to be drag enabled for dropping into the #content div. However, the first problem is that I\'m not getting an alert on the click hand

I'm trying to enable each of the list items classed "draggable" to be drag enabled for dropping into the #content div. However, the first problem is that I'm not getting an alert on the click handler. What am I missing?

<script type="text/javascript" src="<?php echo plugins_url('', __FILE__)?>/jquery-ui.js"></script&g开发者_运维知识库t;
<script type="text/javascript">
    jQuery('.draggable').click
    (
        function()
        {
            alert('clicked'); //DOES NOT FIRE
            jQuery(this).draggable();
            jQuery( "#content" ).droppable
            ({  
                drop: function( event, ui ) 
                {
                    //drop/paste jQuery(this).text(); 
                }
            });
        });
</script>

<ul class="keywords">
    <li class="draggable" id="kw-1">keyword one</li>
    <li class="draggable" id="kw-2">keyword two</li>
    <li class="draggable" id="kw-3">keyword three</li>
</ul>


Can you check if your jquery is loaded correctly? Your script only shows that you are loading jquery-ui.js.

Otherwise, your code works when both jquery and jquery-ui are loaded.

0

精彩评论

暂无评论...
验证码 换一张
取 消