简体   繁体   中英

if i apply draggable to a div wrapper, how to i resolve the case of click dragging the child input box?

I have a small segment of code:

<div>
  <input type="text" />
</div>

and want to make it draggable:

$("div").draggable();

it works if we drag the div, but if you click-drag on the textbox, a stopPropigation seems to be called (possibly from within the focus event).

How would we resolve this?

$("div").draggable({cancel:null});

will get it working. it removes the default flags determined by the jQuery API.

see: http://api.jqueryui.com/draggable/#option-cancel

example: http://jsfiddle.net/XPN5h/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM