I can easily make a <div> element draggable, but not a <button> element. How can I make the <button> draggable, too?
<div>
<button>
$(init); function init() { $('#makeMeDraggable1').draggable(); $('#makeMeDraggable2').draggable(); }
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script> <script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.8.14/jquery-ui.js"></script> <div id="makeMeDraggable1">Drag me!</div> <button id="makeMeDraggable1">Drag me!</button>
Its not a bug , use this, $('input[type=button]').draggable({cancel:false}); You need to cancel the default click event of the button.
$('input[type=button]').draggable({cancel:false});
1.4m articles
1.4m replys
5 comments
57.0k users