I just tried to dragg a button but i am not able to do that.
***CSS***
.aDiv_class {height:200px; width 150px; border: 1px solid gray; }
.dButton_class {hei开发者_如何学编程ght: 175px; width:125px; background: url('button.gif'); }
***HTML***
<div class="aDiv_Class">
<input type="button" class="aButton_class" />
</div>
***JS***
$(function() {
/* $('.aDiv_Class').draggable(); // it works & a div attached with button can be dragged */
$('.aButton_class').draggable(); // I just wanted to drag this button but can't
});
$('.aButton_class').draggable();
you are missing the .
there is a . missing
$('aButton_class').draggable();
should be
$('.aButton_class').draggable();
edit
it may be that the draggable plugin does not support dragging on buttons.
you could, i guess, try to remove the click even from the button but then it wouldn't be a button anymore. and that, i think, is why draggable won't work on a button.
精彩评论