Draggable and Clickable input element using jquery

前端 未结 4 1040
抹茶落季
抹茶落季 2021-01-06 17:44

I have an input element inside a draggable div. My code should do the following things:

  • When I drag my input element, entire draggable div should be dragged. (
4条回答
  •  长情又很酷
    2021-01-06 18:09

    Really old question but I have a slightly different solution, so answering here.

    Disable draggable for input element by setting cancel attribute in the draggable initialiser. I think in most situations it is a small compromise. But YMMV.

    $(".card").draggable({
         cancel: "input"
    });
    

提交回复
热议问题